hammer_cli_foreman 3.7.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes.md +7 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ka/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/test/functional/associating_commands_test.rb +2 -2
- data/test/functional/commands/list_test.rb +4 -4
- data/test/functional/report_template_test.rb +4 -4
- data/test/functional/virtual_machine_test.rb +4 -4
- data/test/test_helper.rb +0 -1
- data/test/unit/api/interactive_basic_auth_test.rb +2 -2
- data/test/unit/api/oauth/oauth_authentication_code_grant_test.rb +2 -2
- data/test/unit/api/oauth/oauth_password_grant_test.rb +2 -2
- data/test/unit/api/session_authenticator_wrapper_test.rb +6 -6
- data/test/unit/architecture_test.rb +12 -12
- data/test/unit/audit_test.rb +6 -6
- data/test/unit/auth_source_external.rb +5 -5
- data/test/unit/auth_source_ldap_test.rb +12 -12
- data/test/unit/bookmark_test.rb +12 -12
- data/test/unit/commands_test.rb +5 -5
- data/test/unit/common_parameter_test.rb +10 -10
- data/test/unit/compute_profile_test.rb +12 -12
- data/test/unit/compute_resource_test.rb +18 -18
- data/test/unit/config_report_test.rb +7 -7
- data/test/unit/domain_test.rb +16 -16
- data/test/unit/exception_handler_test.rb +1 -1
- data/test/unit/external_usergroup_test.rb +15 -15
- data/test/unit/fact_test.rb +3 -3
- data/test/unit/filter_test.rb +18 -18
- data/test/unit/helpers/command.rb +1 -1
- data/test/unit/helpers/resource_disabled.rb +1 -1
- data/test/unit/host_test.rb +35 -35
- data/test/unit/hostgroup_test.rb +18 -18
- data/test/unit/image_test.rb +15 -15
- data/test/unit/location_test.rb +12 -12
- data/test/unit/mail_notification_test.rb +6 -6
- data/test/unit/media_test.rb +12 -12
- data/test/unit/model_test.rb +12 -12
- data/test/unit/operating_system_test.rb +16 -16
- data/test/unit/option_builders_test.rb +2 -2
- data/test/unit/organization_test.rb +12 -12
- data/test/unit/output/formatters_test.rb +4 -4
- data/test/unit/param_filters_test.rb +2 -2
- data/test/unit/partition_table_test.rb +14 -14
- data/test/unit/realm_test.rb +12 -12
- data/test/unit/role_test.rb +14 -14
- data/test/unit/settings_test.rb +5 -5
- data/test/unit/smart_proxy_test.rb +14 -14
- data/test/unit/subnet_test.rb +12 -12
- data/test/unit/template_test.rb +16 -16
- data/test/unit/user_test.rb +12 -12
- data/test/unit/usergroup_test.rb +12 -12
- metadata +29 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee6e69c32f2da750f35474c76deab901c34156e02f588831793b7f668e3445db
|
4
|
+
data.tar.gz: db9db4349a41cf3e1058b33de2cdb599df9526dc6477c12d8fbb8cb3cfccba1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38103b52f65f395870d1cf31da86d4df330248f06ffceb346ed63ec1c9bfb7a7f79a8bfd30fd46d458af97b47ef3c9d08cdd32c056e9eb4765bbef4f2d74be91
|
7
|
+
data.tar.gz: 5c57d8514e09458120a4e01dda31de420b27c85616572ad6577fccf486065294d9308b6b70f344c36070b4d08e52dbfd6f5d78a980f98e81256d95f45ff84a15
|
data/doc/release_notes.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
+
### 3.8.0 (2023-08-25)
|
4
|
+
* Support mocha 2.1 ([PR #618](https://github.com/theforeman/hammer-cli-foreman/pull/618)), [#34879](http://projects.theforeman.org/issues/34879)
|
5
|
+
* Add ga to run tests on ruby 3+ ([PR #617](https://github.com/theforeman/hammer-cli-foreman/pull/617))
|
6
|
+
* Update tx for hammer-cli-foreman, [#36315](http://projects.theforeman.org/issues/36315)
|
7
|
+
* Add packit config
|
8
|
+
* Bump to 3.8.0-develop
|
9
|
+
|
3
10
|
### 3.7.0 (2023-05-23)
|
4
11
|
* Update rake for hammer-cli-foreman ([PR #613](https://github.com/theforeman/hammer-cli-foreman/pull/613)), [#36337](http://projects.theforeman.org/issues/36337)
|
5
12
|
* Update minitest version ([PR #611](https://github.com/theforeman/hammer-cli-foreman/pull/611)), [#36349](http://projects.theforeman.org/issues/36349)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), 'test_helper')
|
|
3
3
|
require 'hammer_cli_foreman/operating_system'
|
4
4
|
|
5
5
|
describe HammerCLIForeman::OperatingSystem do
|
6
|
-
|
6
|
+
describe 'AddProvisioningTemplateCommand' do
|
7
7
|
before do
|
8
8
|
@cmd = ['os', 'add-provisioning-template']
|
9
9
|
@os_before_update = {
|
@@ -106,7 +106,7 @@ describe HammerCLIForeman::OperatingSystem do
|
|
106
106
|
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
describe 'RemoveProvisioningTemplateCommand' do
|
110
110
|
before do
|
111
111
|
@cmd = ['os', 'remove-provisioning-template']
|
112
112
|
@os_before_update = {
|
@@ -33,7 +33,7 @@ describe HammerCLIForeman::ListCommand do
|
|
33
33
|
HammerCLI::Settings.clear
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
describe 'help' do
|
37
37
|
let(:cmd) { ['host', 'list'] }
|
38
38
|
let(:params) { ['--help'] }
|
39
39
|
|
@@ -49,7 +49,7 @@ describe HammerCLIForeman::ListCommand do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "api interaction" do
|
52
|
-
|
52
|
+
describe "without per_page in settings" do
|
53
53
|
it "fetches only first page when there's not enough records" do
|
54
54
|
expect_paged_call(1, 1000, 10)
|
55
55
|
result = run_cmd([], {}, TestList)
|
@@ -86,7 +86,7 @@ describe HammerCLIForeman::ListCommand do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
|
89
|
+
describe "with per_page in settings" do
|
90
90
|
let(:per_page_in_settings) { 30 }
|
91
91
|
before do
|
92
92
|
HammerCLI::Settings.load({ :ui => { :per_page => per_page_in_settings } })
|
@@ -139,7 +139,7 @@ describe HammerCLIForeman::ListCommand do
|
|
139
139
|
assert_cmd(expected_result, result)
|
140
140
|
end
|
141
141
|
|
142
|
-
|
142
|
+
describe 'with per_page in settings' do
|
143
143
|
before do
|
144
144
|
HammerCLI::Settings.load({ :ui => { :per_page => '1' } })
|
145
145
|
end
|
@@ -114,7 +114,7 @@ describe 'report-template' do
|
|
114
114
|
|
115
115
|
it 'invokes editor in interactive mode' do
|
116
116
|
params = ['--name=test', '--default=yes', "--interactive", '--locked=no', '--snippet=no']
|
117
|
-
HammerCLI.expects(:open_in_editor).with("",
|
117
|
+
HammerCLI.expects(:open_in_editor).with("", content_type: "report_template", suffix: ".erb").returns('Template content')
|
118
118
|
api_expects(:report_templates, :create, 'Create template').with_params(
|
119
119
|
'report_template' => {
|
120
120
|
'name' => 'test',
|
@@ -181,7 +181,7 @@ describe 'report-template' do
|
|
181
181
|
it 'invokes editor in interactive mode' do
|
182
182
|
params = ['--id=3', '--new-name=test', '--default=yes', "--interactive", '--locked=no', '--snippet=no']
|
183
183
|
HammerCLI.expects(:open_in_editor).with(
|
184
|
-
"Template Content",
|
184
|
+
"Template Content", content_type: "report_template", suffix: ".erb").returns('Template content')
|
185
185
|
api_expects(:report_templates, :show, 'Show').with_params('id' => '3').returns(third_report)
|
186
186
|
api_expects(:report_templates, :update, 'Update template').with_params(
|
187
187
|
'report_template' => {
|
@@ -307,7 +307,7 @@ describe 'report-template' do
|
|
307
307
|
{ 'job_id' => job_id, 'data_url' => "/report_data/#{job_id}" }
|
308
308
|
end
|
309
309
|
|
310
|
-
|
310
|
+
describe 'without --wait' do
|
311
311
|
it 'schedule report and prints out data for getting the result' do
|
312
312
|
params = ['--id=3', '--inputs=Host filter=filter']
|
313
313
|
api_expects(:report_templates, :schedule_report, 'Schedule').with_params(
|
@@ -320,7 +320,7 @@ describe 'report-template' do
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
-
|
323
|
+
describe 'with --wait' do
|
324
324
|
it 'generates the report to the file' do
|
325
325
|
params = ['--id=3', '--inputs=Host filter=filter', '--wait', '--path=/tmp']
|
326
326
|
api_expects(:report_templates, :schedule_report, 'Schedule').with_params(
|
@@ -5,7 +5,7 @@ require 'hammer_cli_foreman/compute_resource'
|
|
5
5
|
|
6
6
|
describe HammerCLIForeman::VirtualMachine do
|
7
7
|
|
8
|
-
|
8
|
+
describe "InfoCommand" do
|
9
9
|
before do
|
10
10
|
@cmd = ["compute-resource", "virtual-machine", "info"]
|
11
11
|
@vm = {
|
@@ -43,7 +43,7 @@ describe HammerCLIForeman::VirtualMachine do
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
describe "ListCommand" do
|
47
47
|
before do
|
48
48
|
@cmd = ["compute-resource", "virtual-machines"]
|
49
49
|
@available_virtual_machines = [
|
@@ -68,7 +68,7 @@ describe HammerCLIForeman::VirtualMachine do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
describe "PowerCommand" do
|
72
72
|
before do
|
73
73
|
@cmd = ["compute-resource", "virtual-machine", "power"]
|
74
74
|
end
|
@@ -97,7 +97,7 @@ describe HammerCLIForeman::VirtualMachine do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
|
100
|
+
describe "DeleteCommand" do
|
101
101
|
before do
|
102
102
|
@cmd = ["compute-resource", "virtual-machine", "delete"]
|
103
103
|
end
|
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,7 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
|
|
4
4
|
let(:request) { mock() }
|
5
5
|
let(:args) { {} }
|
6
6
|
|
7
|
-
|
7
|
+
describe "interactive mode" do
|
8
8
|
before :each do
|
9
9
|
HammerCLI.stubs(:interactive?).returns true
|
10
10
|
end
|
@@ -42,7 +42,7 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
describe "non-interactive mode" do
|
46
46
|
it "doesn't ask for credentials when they're not provided" do
|
47
47
|
HammerCLI.stubs(:interactive?).returns false
|
48
48
|
auth = HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, nil)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
2
|
|
3
3
|
describe HammerCLIForeman::Api::Oauth::AuthenticationCodeGrant do
|
4
|
-
let(:request) {
|
4
|
+
let(:request) { {} }
|
5
5
|
let(:args) { {} }
|
6
6
|
let(:params) {{
|
7
7
|
oidc_redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
@@ -33,7 +33,7 @@ describe HammerCLIForeman::Api::Oauth::AuthenticationCodeGrant do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
describe "interactive mode" do
|
37
37
|
before :each do
|
38
38
|
HammerCLI.stubs(:interactive?).returns true
|
39
39
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
2
|
|
3
3
|
describe HammerCLIForeman::Api::Oauth::PasswordGrant do
|
4
|
-
let(:request) {
|
4
|
+
let(:request) { {} }
|
5
5
|
let(:args) { {} }
|
6
6
|
let(:params) {{
|
7
7
|
username: 'user1',
|
@@ -31,7 +31,7 @@ describe HammerCLIForeman::Api::Oauth::PasswordGrant do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
describe "interactive mode" do
|
35
35
|
before :each do
|
36
36
|
HammerCLI.stubs(:interactive?).returns true
|
37
37
|
end
|
@@ -52,7 +52,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe '#authenticate' do
|
55
|
-
|
55
|
+
describe "when there's saved session" do
|
56
56
|
it 'sets session id in cookies for basic auth' do
|
57
57
|
session_params = {
|
58
58
|
session_id: 'SOME_SESSION_ID', auth_type: 'Basic_Auth'
|
@@ -139,7 +139,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
|
142
|
+
describe "when the session file is corrupted" do
|
143
143
|
it 'reports error' do
|
144
144
|
_dir, _out, err = prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
145
145
|
write_session(dir, '{not a valid: json')
|
@@ -152,7 +152,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
|
155
|
+
describe "when no session is saved" do
|
156
156
|
it 'passes to wrapped authenticator' do
|
157
157
|
prepare_session_storage do |auth, dir|
|
158
158
|
wrapped_auth.expects(:authenticate).with(request, args)
|
@@ -164,7 +164,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
describe '#error' do
|
167
|
-
|
167
|
+
describe 'when there is existing session' do
|
168
168
|
it 'sets session id to nil on unauthorized exception' do
|
169
169
|
prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
170
170
|
ex = RestClient::Unauthorized.new
|
@@ -204,7 +204,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
|
207
|
+
describe 'when user has changed' do
|
208
208
|
it 'sets a special error message' do
|
209
209
|
prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
210
210
|
auth.force_user_change
|
@@ -227,7 +227,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
-
|
230
|
+
describe 'when there is no existing session' do
|
231
231
|
it 'passes exception to wrapped authenticator on unauthorized exception' do
|
232
232
|
prepare_session_storage do |auth, dir|
|
233
233
|
ex = RestClient::Unauthorized.new
|
@@ -7,21 +7,21 @@ describe HammerCLIForeman::Architecture do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:architectures, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::Architecture::ListCommand.new("", ctx) }
|
16
16
|
|
17
|
-
|
17
|
+
describe "parameters" do
|
18
18
|
it_should_accept "no arguments"
|
19
19
|
it_should_accept_search_params
|
20
20
|
it_should_accept 'organization', ['--organization-id=1']
|
21
21
|
it_should_accept 'location', ['--location-id=1']
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
describe "output" do
|
25
25
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
26
|
|
27
27
|
it_should_print_n_records
|
@@ -32,11 +32,11 @@ describe HammerCLIForeman::Architecture do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
|
-
|
35
|
+
describe "InfoCommand" do
|
36
36
|
|
37
37
|
let(:cmd) { HammerCLIForeman::Architecture::InfoCommand.new("", ctx) }
|
38
38
|
|
39
|
-
|
39
|
+
describe "parameters" do
|
40
40
|
it_should_accept "id", ["--id=1"]
|
41
41
|
it_should_accept "name", ["--name=arch"]
|
42
42
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -44,7 +44,7 @@ describe HammerCLIForeman::Architecture do
|
|
44
44
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
describe "output" do
|
48
48
|
with_params ["--id=1"] do
|
49
49
|
it_should_print_n_records 1
|
50
50
|
it_should_print_column "Name"
|
@@ -55,11 +55,11 @@ describe HammerCLIForeman::Architecture do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
|
58
|
-
|
58
|
+
describe "CreateCommand" do
|
59
59
|
|
60
60
|
let(:cmd) { HammerCLIForeman::Architecture::CreateCommand.new("", ctx) }
|
61
61
|
|
62
|
-
|
62
|
+
describe "parameters" do
|
63
63
|
it_should_accept "name", ["--name=arch"]
|
64
64
|
it_should_accept 'organization', %w[--name=arch --organization-id=1]
|
65
65
|
it_should_accept 'location', %w[--name=arch --location-id=1]
|
@@ -70,11 +70,11 @@ describe HammerCLIForeman::Architecture do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
|
73
|
-
|
73
|
+
describe "DeleteCommand" do
|
74
74
|
|
75
75
|
let(:cmd) { HammerCLIForeman::Architecture::DeleteCommand.new("", ctx) }
|
76
76
|
|
77
|
-
|
77
|
+
describe "parameters" do
|
78
78
|
it_should_accept "name", ["--name=arch"]
|
79
79
|
it_should_accept "id", ["--id=1"]
|
80
80
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -85,11 +85,11 @@ describe HammerCLIForeman::Architecture do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
|
88
|
-
|
88
|
+
describe "UpdateCommand" do
|
89
89
|
|
90
90
|
let(:cmd) { HammerCLIForeman::Architecture::UpdateCommand.new("", ctx) }
|
91
91
|
|
92
|
-
|
92
|
+
describe "parameters" do
|
93
93
|
it_should_accept "name", ["--name=arch", "--new-name=arch2"]
|
94
94
|
it_should_accept "id", ["--id=1", "--new-name=arch2"]
|
95
95
|
it_should_accept 'organization', %w[--id=1 --new-name=arch2 --organization-id=1]
|
data/test/unit/audit_test.rb
CHANGED
@@ -6,19 +6,19 @@ require 'hammer_cli_foreman/audit'
|
|
6
6
|
describe HammerCLIForeman::Audit do
|
7
7
|
include CommandTestHelper
|
8
8
|
|
9
|
-
|
9
|
+
describe "ListCommand" do
|
10
10
|
before do
|
11
11
|
ResourceMocks.mock_action_call(:audits, :index, [])
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:cmd) { HammerCLIForeman::Audit::ListCommand.new("", ctx) }
|
15
15
|
|
16
|
-
|
16
|
+
describe "parameters" do
|
17
17
|
it_should_accept "no arguments"
|
18
18
|
it_should_accept_search_params
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
describe "output" do
|
22
22
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
23
23
|
|
24
24
|
it_should_print_n_records
|
@@ -32,18 +32,18 @@ describe HammerCLIForeman::Audit do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
describe "InfoCommand" do
|
36
36
|
before do
|
37
37
|
cmd.stubs(:extend_data)
|
38
38
|
end
|
39
39
|
|
40
40
|
let(:cmd) { HammerCLIForeman::Audit::InfoCommand.new("", ctx) }
|
41
41
|
|
42
|
-
|
42
|
+
describe "parameters" do
|
43
43
|
it_should_accept "id", ["--id=1"]
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
describe "output" do
|
47
47
|
with_params ["--id=1"] do
|
48
48
|
it_should_print_n_records 1
|
49
49
|
it_should_print_column "Id"
|
@@ -7,20 +7,20 @@ describe HammerCLIForeman::AuthSourceExternal do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe 'ListCommand' do
|
11
11
|
before :each do
|
12
12
|
ResourceMocks.auth_source_external_index
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::AuthSourceExternal::ListCommand.new('', ctx) }
|
16
16
|
|
17
|
-
|
17
|
+
describe 'parameters' do
|
18
18
|
it_should_accept 'no arguments'
|
19
19
|
it_should_accept 'per page', ['--per-page=1']
|
20
20
|
it_should_accept 'page', ['--page=2']
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
describe 'output' do
|
24
24
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
25
25
|
|
26
26
|
it_should_print_n_records 1
|
@@ -29,10 +29,10 @@ describe HammerCLIForeman::AuthSourceExternal do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
describe 'UpdateCommand' do
|
33
33
|
let(:cmd) { HammerCLIForeman::AuthSourceExternal::UpdateCommand.new('', ctx) }
|
34
34
|
|
35
|
-
|
35
|
+
describe 'parameters' do
|
36
36
|
it_should_accept 'name', ['--name=External', '--new-name=auth-external-1']
|
37
37
|
it_should_accept 'id', ['--id=11', '--new-name=auth-external-2']
|
38
38
|
end
|
@@ -7,20 +7,20 @@ describe HammerCLIForeman::AuthSourceLdap do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before :each do
|
12
12
|
ResourceMocks.auth_source_ldap_index
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::AuthSourceLdap::ListCommand.new("", ctx) }
|
16
16
|
|
17
|
-
|
17
|
+
describe "parameters" do
|
18
18
|
it_should_accept "no arguments"
|
19
19
|
it_should_accept "per page", ["--per-page=1"]
|
20
20
|
it_should_accept "page", ["--page=2"]
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
describe "output" do
|
24
24
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
25
25
|
|
26
26
|
it_should_print_n_records 1
|
@@ -34,17 +34,17 @@ describe HammerCLIForeman::AuthSourceLdap do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
|
37
|
-
|
37
|
+
describe "InfoCommand" do
|
38
38
|
|
39
39
|
let(:cmd) { HammerCLIForeman::AuthSourceLdap::InfoCommand.new("", ctx) }
|
40
40
|
|
41
|
-
|
41
|
+
describe "parameters" do
|
42
42
|
it_should_accept "id", ["--id=1"]
|
43
43
|
it_should_accept "name", ["--name=arch"]
|
44
44
|
#it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
describe "output" do
|
48
48
|
with_params ["--id=1"] do
|
49
49
|
it_should_print_n_records 1
|
50
50
|
it_should_print_columns ["Server", "Account", "Attribute mappings", "Locations", "Organizations"]
|
@@ -54,11 +54,11 @@ describe HammerCLIForeman::AuthSourceLdap do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
-
|
57
|
+
describe "CreateCommand" do
|
58
58
|
|
59
59
|
let(:cmd) { HammerCLIForeman::AuthSourceLdap::CreateCommand.new("", ctx) }
|
60
60
|
|
61
|
-
|
61
|
+
describe "parameters" do
|
62
62
|
it_should_accept "all required params", ["--name=arch", "--host=my.host"]
|
63
63
|
# it_should_fail_with "name missing", []
|
64
64
|
# TODO: temporarily disabled, parameters are checked in the api
|
@@ -67,11 +67,11 @@ describe HammerCLIForeman::AuthSourceLdap do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
|
70
|
-
|
70
|
+
describe "DeleteCommand" do
|
71
71
|
|
72
72
|
let(:cmd) { HammerCLIForeman::AuthSourceLdap::DeleteCommand.new("", ctx) }
|
73
73
|
|
74
|
-
|
74
|
+
describe "parameters" do
|
75
75
|
it_should_accept "name", ["--name=arch"]
|
76
76
|
it_should_accept "id", ["--id=1"]
|
77
77
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -80,11 +80,11 @@ describe HammerCLIForeman::AuthSourceLdap do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
|
83
|
-
|
83
|
+
describe "UpdateCommand" do
|
84
84
|
|
85
85
|
let(:cmd) { HammerCLIForeman::AuthSourceLdap::UpdateCommand.new("", ctx) }
|
86
86
|
|
87
|
-
|
87
|
+
describe "parameters" do
|
88
88
|
it_should_accept "name", ["--name=arch", "--new-name=arch2"]
|
89
89
|
it_should_accept "id", ["--id=1", "--new-name=arch2"]
|
90
90
|
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
data/test/unit/bookmark_test.rb
CHANGED
@@ -8,20 +8,20 @@ require 'hammer_cli_foreman/bookmark'
|
|
8
8
|
describe HammerCLIForeman::Bookmark do
|
9
9
|
include CommandTestHelper
|
10
10
|
|
11
|
-
|
11
|
+
describe 'ListCommand' do
|
12
12
|
before :each do
|
13
13
|
ResourceMocks.bookmarks
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:cmd) { HammerCLIForeman::Bookmark::ListCommand.new('', ctx) }
|
17
17
|
|
18
|
-
|
18
|
+
describe 'parameters' do
|
19
19
|
it_should_accept 'no arguments'
|
20
20
|
it_should_accept 'organization', ['--organization-id=1']
|
21
21
|
it_should_accept 'location', ['--location-id=1']
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
describe 'output' do
|
25
25
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
26
|
|
27
27
|
it_should_print_n_records
|
@@ -35,17 +35,17 @@ describe HammerCLIForeman::Bookmark do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
describe 'InfoCommand' do
|
39
39
|
let(:cmd) { HammerCLIForeman::Bookmark::InfoCommand.new('', ctx) }
|
40
40
|
|
41
|
-
|
41
|
+
describe 'parameters' do
|
42
42
|
it_should_accept 'id', ['--id=1']
|
43
43
|
it_should_accept 'name', ['--name=active']
|
44
44
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
45
45
|
it_should_accept 'location', %w[--id=1 --location-id=1]
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
describe 'output' do
|
49
49
|
with_params ['--id=1'] do
|
50
50
|
it_should_print_n_records 1
|
51
51
|
it_should_print_column 'Id'
|
@@ -59,10 +59,10 @@ describe HammerCLIForeman::Bookmark do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
|
62
|
+
describe 'CreateCommand' do
|
63
63
|
let(:cmd) { HammerCLIForeman::Bookmark::CreateCommand.new('', ctx) }
|
64
64
|
|
65
|
-
|
65
|
+
describe 'parameters' do
|
66
66
|
it_should_accept 'name, public, controller, query, organization, location',
|
67
67
|
['--name=active', '--public=1', '--controller=hosts', '--organization-id=1', '--location-id=1',
|
68
68
|
'--query=last_report > "35 minutes ago" and (status.applied > 0 or status.restarted > 0)']
|
@@ -70,10 +70,10 @@ describe HammerCLIForeman::Bookmark do
|
|
70
70
|
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
describe 'DeleteCommand' do
|
74
74
|
let(:cmd) { HammerCLIForeman::Bookmark::DeleteCommand.new('', ctx) }
|
75
75
|
|
76
|
-
|
76
|
+
describe 'parameters' do
|
77
77
|
it_should_accept 'id', ['--id=1']
|
78
78
|
it_should_accept 'name', ['--name=active']
|
79
79
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -81,10 +81,10 @@ describe HammerCLIForeman::Bookmark do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
|
84
|
+
describe 'UpdateCommand' do
|
85
85
|
let(:cmd) { HammerCLIForeman::Bookmark::UpdateCommand.new('', ctx) }
|
86
86
|
|
87
|
-
|
87
|
+
describe 'parameters' do
|
88
88
|
it_should_accept 'id', ['--id=1']
|
89
89
|
it_should_accept 'name', ['--name=active']
|
90
90
|
it_should_accept 'name, public, controller, query, organization, location',
|