hammer_cli_foreman_webhooks 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39d7e941934be4b7423126f92dce297e653866a903ea936e6b9551293c0881c0
4
- data.tar.gz: 5e39bdea6ab727a502fb9e2a71d5e4382ad420e9c51f2fcabff193a7582f4996
3
+ metadata.gz: 133a5a176ca9112fdff6ab7cd9e57803273e42e40d09a1f0c84e161301154232
4
+ data.tar.gz: 5bf0034cb3dcee485ef7075a52ae876189a795ff76855d3bf48f64f45e6acb92
5
5
  SHA512:
6
- metadata.gz: fa5c5cf321e38a1e22046b194c65a47c1ec522de0f7fb86632aff62fd16704eccd0ab256fd0dc650fe4a5294d6d6ae70d18c7591bd300326118cbb9ea7b35eb9
7
- data.tar.gz: 810fdf342cceb67558f09ff437e6f1a5819e6c798d485a9344c33c4169b7d881d619961eb4be8377452edb488267e6435d4c803a2cbe8465ec781d364601576b
6
+ metadata.gz: 548da1e26d44736c168a7ba8a78d2a79473699505f9e9add1a5b7e53c79afc4f76e3f35e05f2c996dc5f036fa6cb2bd5b9f3e233ca2f5c7fd64972712df7fcef
7
+ data.tar.gz: b6d7b33934c39895c662321061f342f8468a68b57e8aedf54e85e8ce91a3d04def5417a341f87170ea40089db68f6e7452f4924d6ab0f7ac9e78e5faaedb44f2
@@ -0,0 +1,28 @@
1
+ require 'hammer_cli/i18n'
2
+
3
+ module HammerCLIForemanWebhooks
4
+ module I18n
5
+ class LocaleDomain < HammerCLI::I18n::LocaleDomain
6
+ def translated_files
7
+ Dir.glob(File.join(__dir__, '..', '**', '*.rb'))
8
+ end
9
+
10
+ def locale_dir
11
+ File.join(__dir__, '..', '..', 'locale')
12
+ end
13
+
14
+ def domain_name
15
+ 'hammer-cli-foreman-webhooks'
16
+ end
17
+ end
18
+
19
+ class SystemLocaleDomain < LocaleDomain
20
+ def locale_dir
21
+ '/usr/share/locale'
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ domain = [HammerCLIForemanWebhooks::I18n::LocaleDomain.new, HammerCLIForemanWebhooks::I18n::SystemLocaleDomain.new].find { |d| d.available? }
28
+ HammerCLI::I18n.add_domain(domain) if domain
@@ -2,6 +2,6 @@
2
2
 
3
3
  module HammerCLIForemanWebhooks
4
4
  def self.version
5
- @version ||= Gem::Version.new '0.0.3'
5
+ @version ||= Gem::Version.new '0.1.0'
6
6
  end
7
7
  end
@@ -21,11 +21,11 @@ module HammerCLIForemanWebhooks
21
21
  field :http_method, _('HTTP Method')
22
22
  field :http_content_type, _('HTTP Content Type')
23
23
  custom_field Fields::Reference, label: _('Webhook Template'), path: [:webhook_template]
24
- field :user, _('User'), Fields::Field, sets: %w[ADDITIONAL ALL]
25
- field :verify_sll, _('Verify SSL'), Fields::Boolean, sets: %w[ADDITIONAL ALL]
26
- field :proxy_authorization, _('Proxy Authorization'), Fields::Boolean, sets: %w[ADDITIONAL ALL]
24
+ field :user, _('User'), Fields::Field
25
+ field :verify_ssl, _('Verify SSL'), Fields::Boolean
26
+ field :proxy_authorization, _('Proxy Authorization'), Fields::Boolean
27
27
  field :ssl_ca_certs, _('X509 Certification Authorities'), Fields::Text, sets: %w[ADDITIONAL ALL]
28
- collection :http_headers, _('HTTP Headers'), sets: %w[ADDITIONAL ALL] do
28
+ collection :http_headers, _('HTTP Headers') do
29
29
  custom_field Fields::KeyValue
30
30
  end
31
31
  HammerCLIForeman::References.timestamps(self)
@@ -42,7 +42,7 @@ module HammerCLIForemanWebhooks
42
42
 
43
43
  build_options without: %i[ssl_ca_certs http_headers]
44
44
 
45
- extend_with(HammerCLIForemanWebhooks::CommandExtensions::Webhook.new(only: :options))
45
+ extend_with(HammerCLIForemanWebhooks::CommandExtensions::Webhook.new(only: %i[option request_params]))
46
46
  end
47
47
 
48
48
  class UpdateCommand < HammerCLIForeman::UpdateCommand
@@ -51,7 +51,7 @@ module HammerCLIForemanWebhooks
51
51
 
52
52
  build_options without: %i[ssl_ca_certs http_headers]
53
53
 
54
- extend_with(HammerCLIForemanWebhooks::CommandExtensions::Webhook.new(only: :options))
54
+ extend_with(HammerCLIForemanWebhooks::CommandExtensions::Webhook.new(only: %i[option request_params]))
55
55
  end
56
56
 
57
57
  class DeleteCommand < HammerCLIForeman::DeleteCommand
@@ -5,6 +5,7 @@ module HammerCLIForemanWebhooks
5
5
  require 'hammer_cli_foreman'
6
6
 
7
7
  require 'hammer_cli_foreman_webhooks/version'
8
+ require 'hammer_cli_foreman_webhooks/i18n'
8
9
  require 'hammer_cli_foreman_webhooks/command_extensions'
9
10
  require 'hammer_cli_foreman_webhooks/webhook'
10
11
  require 'hammer_cli_foreman_webhooks/webhook_template'
@@ -0,0 +1,137 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the hammer-cli-foreman-webhooks package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: hammer-cli-foreman-webhooks 0.0.4\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2023-07-12 17:00+0000\n"
11
+ "PO-Revision-Date: 2023-07-12 17:00+0000\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "Language: \n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19
+
20
+ msgid ""
21
+ "File containing X509 Certification Authorities concatenated in PEM format"
22
+ msgstr ""
23
+
24
+ msgid "Id"
25
+ msgstr ""
26
+
27
+ msgid "Name"
28
+ msgstr ""
29
+
30
+ msgid "Target URL"
31
+ msgstr ""
32
+
33
+ msgid "Enabled"
34
+ msgstr ""
35
+
36
+ msgid "Event"
37
+ msgstr ""
38
+
39
+ msgid "HTTP Method"
40
+ msgstr ""
41
+
42
+ msgid "HTTP Content Type"
43
+ msgstr ""
44
+
45
+ msgid "Webhook Template"
46
+ msgstr ""
47
+
48
+ msgid "User"
49
+ msgstr ""
50
+
51
+ msgid "Verify SSL"
52
+ msgstr ""
53
+
54
+ msgid "Proxy Authorization"
55
+ msgstr ""
56
+
57
+ msgid "X509 Certification Authorities"
58
+ msgstr ""
59
+
60
+ msgid "HTTP Headers"
61
+ msgstr ""
62
+
63
+ msgid "Webhook [%{name}] created."
64
+ msgstr ""
65
+
66
+ msgid "Could not create the webhook"
67
+ msgstr ""
68
+
69
+ msgid "Webhook [%{name}] updated."
70
+ msgstr ""
71
+
72
+ msgid "Could not update the webhook"
73
+ msgstr ""
74
+
75
+ msgid "Webhook [%{name}] deleted."
76
+ msgstr ""
77
+
78
+ msgid "Could not delete the webhook"
79
+ msgstr ""
80
+
81
+ msgid "Description"
82
+ msgstr ""
83
+
84
+ msgid "Locked"
85
+ msgstr ""
86
+
87
+ msgid "Default"
88
+ msgstr ""
89
+
90
+ msgid "Template inputs"
91
+ msgstr ""
92
+
93
+ msgid "Required"
94
+ msgstr ""
95
+
96
+ msgid "Options"
97
+ msgstr ""
98
+
99
+ msgid "Webhook template cloned."
100
+ msgstr ""
101
+
102
+ msgid "Could not clone the webhook template"
103
+ msgstr ""
104
+
105
+ msgid ""
106
+ "Path to a file that contains the webhook template content including metadata"
107
+ msgstr ""
108
+
109
+ msgid "Imported webhook template successfully."
110
+ msgstr ""
111
+
112
+ msgid "Could not import the webhook template"
113
+ msgstr ""
114
+
115
+ msgid "View webhook template content"
116
+ msgstr ""
117
+
118
+ msgid "Webhook template [%{name}] created."
119
+ msgstr ""
120
+
121
+ msgid "Could not create the webhook template"
122
+ msgstr ""
123
+
124
+ msgid "Webhook template [%{name}] updated."
125
+ msgstr ""
126
+
127
+ msgid "Could not update the webhook template"
128
+ msgstr ""
129
+
130
+ msgid "Webhook template [%{name}] deleted."
131
+ msgstr ""
132
+
133
+ msgid "Could not delete the webhook template"
134
+ msgstr ""
135
+
136
+ msgid "The webhook template has been saved to %{path}."
137
+ msgstr ""
@@ -0,0 +1,180 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the hammer-cli-foreman-webhooks package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: hammer-cli-foreman-webhooks 0.0.4\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2023-07-12 17:00+0000\n"
12
+ "PO-Revision-Date: 2023-07-12 17:00+0000\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "Language: \n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=UTF-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
+
21
+ #: ../lib/hammer_cli_foreman_webhooks/command_extensions/webhook.rb:7
22
+ msgid "File containing X509 Certification Authorities concatenated in PEM format"
23
+ msgstr ""
24
+
25
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:9
26
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:9
27
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:24
28
+ msgid "Id"
29
+ msgstr ""
30
+
31
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:10
32
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:10
33
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:25
34
+ msgid "Name"
35
+ msgstr ""
36
+
37
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:11
38
+ msgid "Target URL"
39
+ msgstr ""
40
+
41
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:12
42
+ msgid "Enabled"
43
+ msgstr ""
44
+
45
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:20
46
+ msgid "Event"
47
+ msgstr ""
48
+
49
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:21
50
+ msgid "HTTP Method"
51
+ msgstr ""
52
+
53
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:22
54
+ msgid "HTTP Content Type"
55
+ msgstr ""
56
+
57
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:23
58
+ msgid "Webhook Template"
59
+ msgstr ""
60
+
61
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:24
62
+ msgid "User"
63
+ msgstr ""
64
+
65
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:25
66
+ msgid "Verify SSL"
67
+ msgstr ""
68
+
69
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:26
70
+ msgid "Proxy Authorization"
71
+ msgstr ""
72
+
73
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:27
74
+ msgid "X509 Certification Authorities"
75
+ msgstr ""
76
+
77
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:28
78
+ msgid "HTTP Headers"
79
+ msgstr ""
80
+
81
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:40
82
+ msgid "Webhook [%{name}] created."
83
+ msgstr ""
84
+
85
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:41
86
+ msgid "Could not create the webhook"
87
+ msgstr ""
88
+
89
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:49
90
+ msgid "Webhook [%{name}] updated."
91
+ msgstr ""
92
+
93
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:50
94
+ msgid "Could not update the webhook"
95
+ msgstr ""
96
+
97
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:58
98
+ msgid "Webhook [%{name}] deleted."
99
+ msgstr ""
100
+
101
+ #: ../lib/hammer_cli_foreman_webhooks/webhook.rb:59
102
+ msgid "Could not delete the webhook"
103
+ msgstr ""
104
+
105
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:18
106
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:26
107
+ msgid "Description"
108
+ msgstr ""
109
+
110
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:19
111
+ msgid "Locked"
112
+ msgstr ""
113
+
114
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:20
115
+ msgid "Default"
116
+ msgstr ""
117
+
118
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:23
119
+ msgid "Template inputs"
120
+ msgstr ""
121
+
122
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:27
123
+ msgid "Required"
124
+ msgstr ""
125
+
126
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:28
127
+ msgid "Options"
128
+ msgstr ""
129
+
130
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:39
131
+ msgid "Webhook template cloned."
132
+ msgstr ""
133
+
134
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:40
135
+ msgid "Could not clone the webhook template"
136
+ msgstr ""
137
+
138
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:53
139
+ msgid "Path to a file that contains the webhook template content including metadata"
140
+ msgstr ""
141
+
142
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:60
143
+ msgid "Imported webhook template successfully."
144
+ msgstr ""
145
+
146
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:61
147
+ msgid "Could not import the webhook template"
148
+ msgstr ""
149
+
150
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:68
151
+ msgid "View webhook template content"
152
+ msgstr ""
153
+
154
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:78
155
+ msgid "Webhook template [%{name}] created."
156
+ msgstr ""
157
+
158
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:79
159
+ msgid "Could not create the webhook template"
160
+ msgstr ""
161
+
162
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:85
163
+ msgid "Webhook template [%{name}] updated."
164
+ msgstr ""
165
+
166
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:86
167
+ msgid "Could not update the webhook template"
168
+ msgstr ""
169
+
170
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:92
171
+ msgid "Webhook template [%{name}] deleted."
172
+ msgstr ""
173
+
174
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:93
175
+ msgid "Could not delete the webhook template"
176
+ msgstr ""
177
+
178
+ #: ../lib/hammer_cli_foreman_webhooks/webhook_template.rb:103
179
+ msgid "The webhook template has been saved to %{path}."
180
+ msgstr ""
@@ -0,0 +1,144 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the hammer-cli-foreman-webhooks package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ # Translators:
7
+ # Temuri Doghonadze <temuri.doghonadze@gmail.com>, 2023
8
+ #
9
+ #, fuzzy
10
+ msgid ""
11
+ msgstr ""
12
+ "Project-Id-Version: hammer-cli-foreman-webhooks 0.0.4\n"
13
+ "Report-Msgid-Bugs-To: \n"
14
+ "POT-Creation-Date: 2023-07-12 17:00+0000\n"
15
+ "PO-Revision-Date: 2023-10-05 11:06+0000\n"
16
+ "Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>, 2023\n"
17
+ "Language-Team: Georgian (https://app.transifex.com/foreman/teams/114/ka/)\n"
18
+ "MIME-Version: 1.0\n"
19
+ "Content-Type: text/plain; charset=UTF-8\n"
20
+ "Content-Transfer-Encoding: 8bit\n"
21
+ "Language: ka\n"
22
+ "Plural-Forms: nplurals=2; plural=(n!=1);\n"
23
+
24
+ msgid ""
25
+ "File containing X509 Certification Authorities concatenated in PEM format"
26
+ msgstr ""
27
+ "ფაილი, რომელიც PEM ფორმატში გაერთიანებულ X509 სერტიფიკატის ავტორიტეტებს "
28
+ "შეიცავს"
29
+
30
+ msgid "Id"
31
+ msgstr "Id"
32
+
33
+ msgid "Name"
34
+ msgstr "სახელი"
35
+
36
+ msgid "Target URL"
37
+ msgstr "სამიზნე URL"
38
+
39
+ msgid "Enabled"
40
+ msgstr "ჩაირთო"
41
+
42
+ msgid "Event"
43
+ msgstr "მოვლენა"
44
+
45
+ msgid "HTTP Method"
46
+ msgstr "HTTP მეთოდი"
47
+
48
+ msgid "HTTP Content Type"
49
+ msgstr "HTTP შემცველობის ტიპი"
50
+
51
+ msgid "Webhook Template"
52
+ msgstr "ვებჰუკის შაბლონი"
53
+
54
+ msgid "User"
55
+ msgstr "მომხმარებელი"
56
+
57
+ msgid "Verify SSL"
58
+ msgstr "SSL-ის შემოწმება"
59
+
60
+ msgid "Proxy Authorization"
61
+ msgstr "პროქსის ავტორიზაცია"
62
+
63
+ msgid "X509 Certification Authorities"
64
+ msgstr "X509 CA"
65
+
66
+ msgid "HTTP Headers"
67
+ msgstr "HTTP თავსართები"
68
+
69
+ msgid "Webhook [%{name}] created."
70
+ msgstr "ვებჰუკი [%{name}] შეიქმნა."
71
+
72
+ msgid "Could not create the webhook"
73
+ msgstr "ვებჰუკის შექმნა შეუძლებელია"
74
+
75
+ msgid "Webhook [%{name}] updated."
76
+ msgstr "ვებჰუკი [%{name}] განახლდა."
77
+
78
+ msgid "Could not update the webhook"
79
+ msgstr "ვებჰუკის განახლება შეუძლებელია"
80
+
81
+ msgid "Webhook [%{name}] deleted."
82
+ msgstr "ვებჰუკი [%{name}] წაიშალა."
83
+
84
+ msgid "Could not delete the webhook"
85
+ msgstr "ვებჰუკის წაშლა შეუძლებელია"
86
+
87
+ msgid "Description"
88
+ msgstr "აღწერა"
89
+
90
+ msgid "Locked"
91
+ msgstr "დაბლოკილია"
92
+
93
+ msgid "Default"
94
+ msgstr "ნაგულისხმევი"
95
+
96
+ msgid "Template inputs"
97
+ msgstr "შაბლონის შეყვანები"
98
+
99
+ msgid "Required"
100
+ msgstr "საჭიროა"
101
+
102
+ msgid "Options"
103
+ msgstr "მორგება"
104
+
105
+ msgid "Webhook template cloned."
106
+ msgstr "ვებჰუკის ნიმუში კლონირებულია."
107
+
108
+ msgid "Could not clone the webhook template"
109
+ msgstr "ვებჰუკის ნიმუშის დაკლონვა შეუძლებელია"
110
+
111
+ msgid ""
112
+ "Path to a file that contains the webhook template content including metadata"
113
+ msgstr ""
114
+ "ბილიკი ფაილამდე, რომელიც ვებჰუკის ნიმუშს შეიცავს, მეტამონაცემების ჩათვლით"
115
+
116
+ msgid "Imported webhook template successfully."
117
+ msgstr "ვებჰუკის ნიმუშის შემოტანა წარმატებულია."
118
+
119
+ msgid "Could not import the webhook template"
120
+ msgstr "ვებჰუკის ნიმუშის შემოტანა შეუძლებელია"
121
+
122
+ msgid "View webhook template content"
123
+ msgstr "ვებჰუკის ნიმუშის შემცველობის ნახვა"
124
+
125
+ msgid "Webhook template [%{name}] created."
126
+ msgstr "ვებჰუკის ნიმუში [%{name}] შეიქმნა."
127
+
128
+ msgid "Could not create the webhook template"
129
+ msgstr "ვებჰუკის ნიმუშის შექმნა შეუძლებელია"
130
+
131
+ msgid "Webhook template [%{name}] updated."
132
+ msgstr "ვებჰუკის ნიმუში [%{name}] განახლდა."
133
+
134
+ msgid "Could not update the webhook template"
135
+ msgstr "ვებჰუკის ნიმუშის განახლება შეუძლებელია"
136
+
137
+ msgid "Webhook template [%{name}] deleted."
138
+ msgstr "ვებჰუკის ნიმუში [%{name}] წაიშალა."
139
+
140
+ msgid "Could not delete the webhook template"
141
+ msgstr "ვებჰუკის ნიმუშის წაშლა შეუძლებელია"
142
+
143
+ msgid "The webhook template has been saved to %{path}."
144
+ msgstr "ვებჰუკის შაბლონი %{path}-ში ჩაიწერა."
@@ -0,0 +1,126 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe 'webhook' do
4
+ let(:base_cmd) { %w[webhook] }
5
+ let(:webhook) do
6
+ {
7
+ id: 1,
8
+ name: 'test',
9
+ target_url: 'https://app.example.com',
10
+ enabled: true,
11
+ event: 'user_created.event.foreman',
12
+ http_method: 'POST',
13
+ http_content_type: 'application/json',
14
+ webhook_template: { id: 1, name: 'test' },
15
+ user: 'admin',
16
+ verify_ssl: true,
17
+ proxy_authorization: true,
18
+ ssl_ca_certs: 'certs',
19
+ 'http_headers' => '{"X-Shellhook-Arg-0":"test","X-Shellhook-Arg-1":"2"}',
20
+ created_at: '01/10/2022',
21
+ updated_at: '01/10/2022'
22
+ }
23
+ end
24
+
25
+ describe 'list' do
26
+ let(:cmd) { base_cmd << 'list' }
27
+
28
+ it 'should list all webhooks' do
29
+ api_expects(:webhooks, :index, 'List').with_params(
30
+ 'page' => 1, 'per_page' => 1000
31
+ ).returns(index_response([webhook]))
32
+
33
+ output = IndexMatcher.new(
34
+ [
35
+ ['ID', 'NAME', 'TARGET URL', 'ENABLED'],
36
+ ['1', 'test', 'https://app.example.com', 'yes']
37
+ ]
38
+ )
39
+ expected_result = success_result(output)
40
+
41
+ result = run_cmd(cmd)
42
+ assert_cmd(expected_result, result)
43
+ end
44
+ end
45
+
46
+ describe 'create' do
47
+ let(:cmd) { base_cmd << 'create' }
48
+ let(:params) do
49
+ %w[
50
+ --name=test --target-url=https://app.example.com --enabled=true
51
+ --event=user_created.event.foreman
52
+ --http-headers=X-Shellhook-Arg-0=test,X-Shellhook-Arg-1=2
53
+ ]
54
+ end
55
+
56
+ it 'should create a webhook' do
57
+ api_expects(:webhooks, :create).with_params(
58
+ 'webhook' => {
59
+ 'target_url' => 'https://app.example.com', 'name' => 'test',
60
+ 'enabled' => true, 'event' => 'user_created.event.foreman',
61
+ 'http_headers' => '{"X-Shellhook-Arg-0":"test","X-Shellhook-Arg-1":"2"}'
62
+ }
63
+ ).returns(webhook)
64
+
65
+ expected_result = success_result("Webhook [test] created.\n")
66
+
67
+ result = run_cmd(cmd + params)
68
+ assert_cmd(expected_result, result)
69
+ end
70
+ end
71
+
72
+ describe 'update' do
73
+ let(:cmd) { base_cmd << 'update' }
74
+ let(:params) do
75
+ %w[
76
+ --id=1 --target-url=https://app.example.com --enabled=true
77
+ --event=user_created.event.foreman
78
+ --http-headers=X-Shellhook-Arg-0=test,X-Shellhook-Arg-1=2
79
+ ]
80
+ end
81
+
82
+ it 'should update a webhook' do
83
+ api_expects(:webhooks, :update).with_params(
84
+ 'id' => '1',
85
+ 'webhook' => {
86
+ 'target_url' => 'https://app.example.com',
87
+ 'enabled' => true, 'event' => 'user_created.event.foreman',
88
+ 'http_headers' => '{"X-Shellhook-Arg-0":"test","X-Shellhook-Arg-1":"2"}'
89
+ }
90
+ ).returns(webhook)
91
+
92
+ expected_result = success_result("Webhook [test] updated.\n")
93
+
94
+ result = run_cmd(cmd + params)
95
+ assert_cmd(expected_result, result)
96
+ end
97
+ end
98
+
99
+ describe 'info' do
100
+ let(:cmd) { base_cmd << 'info' }
101
+ let(:params) { %w[--id=1] }
102
+
103
+ it 'should show a webhook' do
104
+ api_expects(:webhooks, :show, 'Show').with_params('id' => '1').returns(webhook)
105
+
106
+ expected_result = success_result(/X-Shellhook-Arg-0/)
107
+
108
+ result = run_cmd(cmd + params)
109
+ assert_cmd(expected_result, result)
110
+ end
111
+ end
112
+
113
+ describe 'delete' do
114
+ let(:cmd) { base_cmd << 'delete' }
115
+ let(:params) { %w[--id=1] }
116
+
117
+ it 'should delete a webhook' do
118
+ api_expects(:webhooks, :destroy, 'Delete').with_params('id' => '1').returns(webhook)
119
+
120
+ expected_result = success_result("Webhook [test] deleted.\n")
121
+
122
+ result = run_cmd(cmd + params)
123
+ assert_cmd(expected_result, result)
124
+ end
125
+ end
126
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman_webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleh Fedorenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-01 00:00:00.000000000 Z
11
+ date: 2024-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hammer_cli_foreman
@@ -43,12 +43,19 @@ files:
43
43
  - lib/hammer_cli_foreman_webhooks.rb
44
44
  - lib/hammer_cli_foreman_webhooks/command_extensions.rb
45
45
  - lib/hammer_cli_foreman_webhooks/command_extensions/webhook.rb
46
+ - lib/hammer_cli_foreman_webhooks/i18n.rb
46
47
  - lib/hammer_cli_foreman_webhooks/version.rb
47
48
  - lib/hammer_cli_foreman_webhooks/webhook.rb
48
49
  - lib/hammer_cli_foreman_webhooks/webhook_template.rb
50
+ - locale/en/LC_MESSAGES/hammer-cli-foreman-webhooks.mo
51
+ - locale/en/hammer-cli-foreman-webhooks.po
52
+ - locale/hammer-cli-foreman-webhooks.pot
53
+ - locale/ka/LC_MESSAGES/hammer-cli-foreman-webhooks.mo
54
+ - locale/ka/hammer-cli-foreman-webhooks.po
49
55
  - test/data/3.3/foreman_api.json
50
56
  - test/functional/test_helper.rb
51
57
  - test/functional/webhook_template_test.rb
58
+ - test/functional/webhook_test.rb
52
59
  - test/test_helper.rb
53
60
  homepage: https://github.com/theforeman/hammer-cli-foreman-webhooks
54
61
  licenses:
@@ -62,14 +69,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
69
  requirements:
63
70
  - - ">="
64
71
  - !ruby/object:Gem::Version
65
- version: '2.5'
72
+ version: '2.7'
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '4'
66
76
  required_rubygems_version: !ruby/object:Gem::Requirement
67
77
  requirements:
68
78
  - - ">="
69
79
  - !ruby/object:Gem::Version
70
80
  version: '0'
71
81
  requirements: []
72
- rubygems_version: 3.1.2
82
+ rubygems_version: 3.2.33
73
83
  signing_key:
74
84
  specification_version: 4
75
85
  summary: Foreman Webhooks plugin for Hammer CLI
@@ -77,4 +87,5 @@ test_files:
77
87
  - test/data/3.3/foreman_api.json
78
88
  - test/functional/test_helper.rb
79
89
  - test/functional/webhook_template_test.rb
90
+ - test/functional/webhook_test.rb
80
91
  - test/test_helper.rb