hammer_cli_foreman 2.3.2 → 2.5.2
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 +27 -3
- data/lib/hammer_cli_foreman/architecture.rb +5 -5
- data/lib/hammer_cli_foreman/bookmark.rb +6 -6
- data/lib/hammer_cli_foreman/command_extensions/ping.rb +21 -2
- data/lib/hammer_cli_foreman/command_extensions/status.rb +1 -1
- data/lib/hammer_cli_foreman/command_extensions/update_common.rb +14 -0
- data/lib/hammer_cli_foreman/command_extensions.rb +1 -0
- data/lib/hammer_cli_foreman/commands.rb +14 -0
- data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
- data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +2 -1
- data/lib/hammer_cli_foreman/compute_resource.rb +22 -0
- data/lib/hammer_cli_foreman/config_group.rb +5 -5
- data/lib/hammer_cli_foreman/config_report.rb +2 -0
- data/lib/hammer_cli_foreman/filter.rb +2 -2
- data/lib/hammer_cli_foreman/host.rb +1 -12
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +6 -5
- data/lib/hammer_cli_foreman/mail_notification.rb +2 -2
- data/lib/hammer_cli_foreman/model.rb +5 -5
- data/lib/hammer_cli_foreman/operating_system.rb +10 -9
- data/lib/hammer_cli_foreman/option_builders.rb +6 -5
- data/lib/hammer_cli_foreman/ping.rb +6 -1
- data/lib/hammer_cli_foreman/registration.rb +18 -0
- data/lib/hammer_cli_foreman/settings.rb +3 -3
- data/lib/hammer_cli_foreman/usergroup.rb +5 -5
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/lib/hammer_cli_foreman.rb +4 -1
- data/locale/ca/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/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/data/2.4/foreman_api.json +1 -0
- data/test/data/2.5/foreman_api.json +1 -0
- data/test/functional/architecture_test.rb +79 -0
- data/test/functional/bookmark_test.rb +22 -1
- data/test/functional/compute_profile_test.rb +54 -0
- data/test/functional/compute_resource_test.rb +37 -0
- data/test/functional/config_group_test.rb +50 -0
- data/test/functional/filter_test.rb +115 -47
- data/test/functional/host_test.rb +94 -12
- data/test/functional/http_proxy_test.rb +12 -0
- data/test/functional/location_test.rb +13 -0
- data/test/functional/mail_notification_test.rb +20 -0
- data/test/functional/media_test.rb +11 -0
- data/test/functional/model_test.rb +50 -0
- data/test/functional/operating_system_test.rb +51 -0
- data/test/functional/ping_test.rb +33 -0
- data/test/functional/realm_test.rb +11 -0
- data/test/functional/registration_test.rb +8 -0
- data/test/functional/report_template_test.rb +11 -0
- data/test/functional/settings_test.rb +21 -0
- data/test/functional/status_test.rb +79 -13
- data/test/functional/template_test.rb +12 -0
- data/test/functional/user_test.rb +11 -0
- data/test/functional/usergroup_test.rb +51 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/apipie_resource_mock.rb +21 -0
- data/test/unit/architecture_test.rb +10 -1
- data/test/unit/bookmark_test.rb +99 -0
- data/test/unit/compute_profile_test.rb +87 -0
- data/test/unit/config_group_test.rb +10 -0
- data/test/unit/config_report_test.rb +1 -0
- data/test/unit/mail_notification_test.rb +53 -0
- data/test/unit/model_test.rb +10 -0
- data/test/unit/operating_system_test.rb +14 -1
- data/test/unit/settings_test.rb +4 -0
- data/test/unit/usergroup_test.rb +10 -0
- metadata +81 -57
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
4
|
+
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
5
|
+
|
6
|
+
require 'hammer_cli_foreman/bookmark'
|
7
|
+
|
8
|
+
describe HammerCLIForeman::Bookmark do
|
9
|
+
include CommandTestHelper
|
10
|
+
|
11
|
+
context 'ListCommand' do
|
12
|
+
before :each do
|
13
|
+
ResourceMocks.bookmarks
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:cmd) { HammerCLIForeman::Bookmark::ListCommand.new('', ctx) }
|
17
|
+
|
18
|
+
context 'parameters' do
|
19
|
+
it_should_accept 'no arguments'
|
20
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
21
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'output' do
|
25
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
|
+
|
27
|
+
it_should_print_n_records
|
28
|
+
it_should_print_column 'Id'
|
29
|
+
it_should_print_column 'Name'
|
30
|
+
it_should_print_column 'Controller'
|
31
|
+
it_should_print_column 'Search Query'
|
32
|
+
it_should_print_column 'Public'
|
33
|
+
it_should_print_column 'Owner Id'
|
34
|
+
it_should_print_column 'Owner Type'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'InfoCommand' do
|
39
|
+
let(:cmd) { HammerCLIForeman::Bookmark::InfoCommand.new('', ctx) }
|
40
|
+
|
41
|
+
context 'parameters' do
|
42
|
+
it_should_accept 'id', ['--id=1']
|
43
|
+
it_should_accept 'name', ['--name=active']
|
44
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
45
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'output' do
|
49
|
+
with_params ['--id=1'] do
|
50
|
+
it_should_print_n_records 1
|
51
|
+
it_should_print_column 'Id'
|
52
|
+
it_should_print_column 'Name'
|
53
|
+
it_should_print_column 'Controller'
|
54
|
+
it_should_print_column 'Search Query'
|
55
|
+
it_should_print_column 'Public'
|
56
|
+
it_should_print_column 'Owner Id'
|
57
|
+
it_should_print_column 'Owner Type'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'CreateCommand' do
|
63
|
+
let(:cmd) { HammerCLIForeman::Bookmark::CreateCommand.new('', ctx) }
|
64
|
+
|
65
|
+
context 'parameters' do
|
66
|
+
it_should_accept 'name, public, controller, query',
|
67
|
+
['--name=active', '--public=1', '--controller=hosts',
|
68
|
+
'--query=last_report > "35 minutes ago" and (status.applied > 0 or status.restarted > 0)']
|
69
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
70
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'DeleteCommand' do
|
76
|
+
let(:cmd) { HammerCLIForeman::Bookmark::DeleteCommand.new('', ctx) }
|
77
|
+
|
78
|
+
context 'parameters' do
|
79
|
+
it_should_accept 'id', ['--id=1']
|
80
|
+
it_should_accept 'name', ['--name=active']
|
81
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
82
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'UpdateCommand' do
|
87
|
+
let(:cmd) { HammerCLIForeman::Bookmark::UpdateCommand.new('', ctx) }
|
88
|
+
|
89
|
+
context 'parameters' do
|
90
|
+
it_should_accept 'id', ['--id=1']
|
91
|
+
it_should_accept 'name', ['--name=active']
|
92
|
+
it_should_accept 'name, public, controller, query',
|
93
|
+
['--name=active', '--public=1', '--controller=hosts',
|
94
|
+
'--query=last_report > "35 minutes ago" and (status.applied > 0 or status.restarted > 0)']
|
95
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
96
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
4
|
+
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
5
|
+
|
6
|
+
require 'hammer_cli_foreman/compute_profile'
|
7
|
+
|
8
|
+
describe HammerCLIForeman::ComputeProfile do
|
9
|
+
include CommandTestHelper
|
10
|
+
|
11
|
+
context 'ListCommand' do
|
12
|
+
before :each do
|
13
|
+
ResourceMocks.compute_profiles
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:cmd) { HammerCLIForeman::ComputeProfile::ListCommand.new('', ctx) }
|
17
|
+
|
18
|
+
context 'parameters' do
|
19
|
+
it_should_accept 'no arguments'
|
20
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
21
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'output' do
|
25
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
|
+
|
27
|
+
it_should_print_n_records
|
28
|
+
it_should_print_column 'Id'
|
29
|
+
it_should_print_column 'Name'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'InfoCommand' do
|
34
|
+
let(:cmd) { HammerCLIForeman::ComputeProfile::InfoCommand.new('', ctx) }
|
35
|
+
|
36
|
+
context 'parameters' do
|
37
|
+
it_should_accept 'id', ['--id=1']
|
38
|
+
it_should_accept 'name', ['--name=test']
|
39
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
40
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'output' do
|
44
|
+
with_params ['--id=1'] do
|
45
|
+
it_should_print_n_records 1
|
46
|
+
it_should_print_column 'Id'
|
47
|
+
it_should_print_column 'Name'
|
48
|
+
it_should_print_column 'Created at'
|
49
|
+
it_should_print_column 'Updated at'
|
50
|
+
it_should_print_column 'Compute attributes'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'CreateCommand' do
|
56
|
+
let(:cmd) { HammerCLIForeman::ComputeProfile::CreateCommand.new('', ctx) }
|
57
|
+
|
58
|
+
context 'parameters' do
|
59
|
+
it_should_accept 'name', ['--name=test']
|
60
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
61
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'DeleteCommand' do
|
67
|
+
let(:cmd) { HammerCLIForeman::ComputeProfile::DeleteCommand.new('', ctx) }
|
68
|
+
|
69
|
+
context 'parameters' do
|
70
|
+
it_should_accept 'id', ['--id=1']
|
71
|
+
it_should_accept 'name', ['--name=test']
|
72
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
73
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'UpdateCommand' do
|
78
|
+
let(:cmd) { HammerCLIForeman::ComputeProfile::UpdateCommand.new('', ctx) }
|
79
|
+
|
80
|
+
context 'parameters' do
|
81
|
+
it_should_accept 'id', ['--id=1']
|
82
|
+
it_should_accept 'name', ['--name=test']
|
83
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
84
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -16,6 +16,8 @@ describe HammerCLIForeman::ConfigGroup do
|
|
16
16
|
context "parameters" do
|
17
17
|
it_should_accept "no arguments"
|
18
18
|
it_should_accept_search_params
|
19
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
20
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
19
21
|
end
|
20
22
|
|
21
23
|
context "output" do
|
@@ -31,6 +33,8 @@ describe HammerCLIForeman::ConfigGroup do
|
|
31
33
|
context "parameters" do
|
32
34
|
it_should_accept "id", ["--id=1"]
|
33
35
|
it_should_accept "name", ["--name=group_x"]
|
36
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
37
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
34
38
|
end
|
35
39
|
|
36
40
|
context "output" do
|
@@ -48,6 +52,8 @@ describe HammerCLIForeman::ConfigGroup do
|
|
48
52
|
|
49
53
|
context "parameters" do
|
50
54
|
it_should_accept "name, puppetclass ids", ["--name=first_group", "--puppet-class-ids=1,2"]
|
55
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
56
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
@@ -57,6 +63,8 @@ describe HammerCLIForeman::ConfigGroup do
|
|
57
63
|
context "parameters" do
|
58
64
|
it_should_accept "name", ["--name=group_x"]
|
59
65
|
it_should_accept "id", ["--id=1"]
|
66
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
67
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
@@ -67,6 +75,8 @@ describe HammerCLIForeman::ConfigGroup do
|
|
67
75
|
context "parameters" do
|
68
76
|
it_should_accept "name", ["--name=group_x"]
|
69
77
|
it_should_accept "id", ["--id=1"]
|
78
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
79
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
70
80
|
end
|
71
81
|
end
|
72
82
|
end
|
@@ -25,6 +25,7 @@ describe HammerCLIForeman::ConfigReport do
|
|
25
25
|
it_should_print_n_records
|
26
26
|
it_should_print_column "Id"
|
27
27
|
it_should_print_column "Host"
|
28
|
+
it_should_print_column "Origin"
|
28
29
|
it_should_print_column "Last report"
|
29
30
|
it_should_print_column "Applied"
|
30
31
|
it_should_print_column "Restarted"
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
4
|
+
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
5
|
+
|
6
|
+
require 'hammer_cli_foreman/mail_notification'
|
7
|
+
|
8
|
+
describe HammerCLIForeman::MailNotification do
|
9
|
+
include CommandTestHelper
|
10
|
+
|
11
|
+
context 'ListCommand' do
|
12
|
+
before :each do
|
13
|
+
ResourceMocks.mail_notifications
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:cmd) { HammerCLIForeman::MailNotification::ListCommand.new('', ctx) }
|
17
|
+
|
18
|
+
context 'parameters' do
|
19
|
+
it_should_accept 'no arguments'
|
20
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
21
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'output' do
|
25
|
+
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
|
+
|
27
|
+
it_should_print_n_records
|
28
|
+
it_should_print_column 'Id'
|
29
|
+
it_should_print_column 'Name'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'InfoCommand' do
|
34
|
+
let(:cmd) { HammerCLIForeman::MailNotification::InfoCommand.new('', ctx) }
|
35
|
+
|
36
|
+
context 'parameters' do
|
37
|
+
it_should_accept 'id', ['--id=1']
|
38
|
+
it_should_accept 'name', ['--name=test']
|
39
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
40
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'output' do
|
44
|
+
with_params ['--id=1'] do
|
45
|
+
it_should_print_n_records 1
|
46
|
+
it_should_print_column 'Id'
|
47
|
+
it_should_print_column 'Name'
|
48
|
+
it_should_print_column 'Description'
|
49
|
+
it_should_print_column 'Subscription type'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/test/unit/model_test.rb
CHANGED
@@ -17,6 +17,8 @@ describe HammerCLIForeman::Model do
|
|
17
17
|
context "parameters" do
|
18
18
|
it_should_accept "no arguments"
|
19
19
|
it_should_accept_search_params
|
20
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
21
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
20
22
|
end
|
21
23
|
|
22
24
|
context "output" do
|
@@ -38,6 +40,8 @@ describe HammerCLIForeman::Model do
|
|
38
40
|
context "parameters" do
|
39
41
|
it_should_accept "id", ["--id=1"]
|
40
42
|
it_should_accept "name", ["--name=model"]
|
43
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
44
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
41
45
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
42
46
|
end
|
43
47
|
|
@@ -63,6 +67,8 @@ describe HammerCLIForeman::Model do
|
|
63
67
|
|
64
68
|
context "parameters" do
|
65
69
|
it_should_accept "name", ["--name=model", "--info=description", "--vendor-class=class", "--hardware-model=model"]
|
70
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
71
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
66
72
|
# it_should_fail_with "name missing", ["--info=description", "--vendor-class=class", "--hardware-model=model"]
|
67
73
|
# TODO: temporarily disabled, parameters are checked in the api
|
68
74
|
end
|
@@ -77,6 +83,8 @@ describe HammerCLIForeman::Model do
|
|
77
83
|
context "parameters" do
|
78
84
|
it_should_accept "name", ["--name=model"]
|
79
85
|
it_should_accept "id", ["--id=1"]
|
86
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
87
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
80
88
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
81
89
|
end
|
82
90
|
|
@@ -90,6 +98,8 @@ describe HammerCLIForeman::Model do
|
|
90
98
|
context "parameters" do
|
91
99
|
it_should_accept "name", ["--name=model", "--new-name=model2", "--info=description", "--vendor-class=class", "--hardware-model=model"]
|
92
100
|
it_should_accept "id", ["--id=1", "--new-name=model2", "--info=description", "--vendor-class=class", "--hardware-model=model"]
|
101
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
102
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
93
103
|
# it_should_fail_with "no params", []
|
94
104
|
# it_should_fail_with "name or id missing", ["--new-name=model2", "--info=description", "--vendor-class=class", "--hardware-model=model"]
|
95
105
|
# TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -18,6 +18,8 @@ describe HammerCLIForeman::OperatingSystem do
|
|
18
18
|
context "parameters" do
|
19
19
|
it_should_accept "no arguments"
|
20
20
|
it_should_accept_search_params
|
21
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
22
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
21
23
|
end
|
22
24
|
|
23
25
|
context "output" do
|
@@ -40,6 +42,8 @@ describe HammerCLIForeman::OperatingSystem do
|
|
40
42
|
context "parameters" do
|
41
43
|
it_should_accept "id", ["--id=1"]
|
42
44
|
it_should_accept "title", ["--title=Rhel 6.5"]
|
45
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
46
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
43
47
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
44
48
|
end
|
45
49
|
|
@@ -70,6 +74,8 @@ describe HammerCLIForeman::OperatingSystem do
|
|
70
74
|
|
71
75
|
context "parameters" do
|
72
76
|
it_should_accept "name, major, minor, family, release name", ["--name=media", "--major=1", "--minor=2", "--family=Red Hat", "--release-name=awesome"]
|
77
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
78
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
73
79
|
# it_should_fail_with "name missing", ["--major=1", "--minor=2", "--family=Red Hat", "--release-name=awesome"]
|
74
80
|
# TODO: temporarily disabled, parameters are checked in the api
|
75
81
|
end
|
@@ -87,6 +93,8 @@ describe HammerCLIForeman::OperatingSystem do
|
|
87
93
|
context "parameters" do
|
88
94
|
it_should_accept "id", ["--id=1"]
|
89
95
|
it_should_accept "title", ["--title=Rhel 6.5"]
|
96
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
97
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
90
98
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
91
99
|
# TODO: temporarily disabled, parameters are checked in the id resolver
|
92
100
|
end
|
@@ -102,6 +110,8 @@ describe HammerCLIForeman::OperatingSystem do
|
|
102
110
|
it_should_accept "id", ["--id=1"]
|
103
111
|
it_should_accept "title", ["--title=Rhel 6.5"]
|
104
112
|
it_should_accept "name, major, minor, family, release name", ["--id=83", "--name=os", "--major=1", "--minor=2", "--family=Red Hat", "--release-name=awesome"]
|
113
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
114
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
105
115
|
# it_should_fail_with "no params", []
|
106
116
|
# it_should_fail_with "label or id missing", ["--name=os", "--major=1", "--minor=2", "--family=Red Hat", "--release-name=awesome"]
|
107
117
|
# TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -126,6 +136,8 @@ describe HammerCLIForeman::OperatingSystem do
|
|
126
136
|
it_should_accept "name, value and os id", ["--name=domain", "--value=val", "--operatingsystem-id=1"]
|
127
137
|
it_should_accept "name, value and os title", ["--name=domain", "--value=val", "--operatingsystem=Rhel 6.5"]
|
128
138
|
it_should_accept "name, value, type and os id", ["--name=domain", "--value=val", "--parameter-type=string", "--operatingsystem-id=1"]
|
139
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
140
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
129
141
|
# it_should_fail_with "name missing", ["--value=val", "--operatingsystem-id=id"]
|
130
142
|
# it_should_fail_with "value missing", ["--name=name", "--operatingsystem-id=id"]
|
131
143
|
# it_should_fail_with "os id missing", ["--name=name", "--value=val"]
|
@@ -142,11 +154,12 @@ describe HammerCLIForeman::OperatingSystem do
|
|
142
154
|
context "parameters" do
|
143
155
|
it_should_accept "name and os id", ["--name=domain", "--operatingsystem-id=1"]
|
144
156
|
it_should_accept "name and os title", ["--name=domain", "--operatingsystem=Rhel 6.5"]
|
157
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
158
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
145
159
|
# it_should_fail_with "name missing", ["--operatingsystem-id=id"]
|
146
160
|
# it_should_fail_with "os id missing", ["--name=name"]
|
147
161
|
# TODO: temporarily disabled, parameters are checked in the id resolver
|
148
162
|
end
|
149
163
|
|
150
164
|
end
|
151
|
-
|
152
165
|
end
|
data/test/unit/settings_test.rb
CHANGED
@@ -18,6 +18,8 @@ describe HammerCLIForeman::Settings do
|
|
18
18
|
context "parameters" do
|
19
19
|
it_should_accept "no arguments"
|
20
20
|
it_should_accept_search_params
|
21
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
22
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
21
23
|
end
|
22
24
|
|
23
25
|
context "output" do
|
@@ -38,6 +40,8 @@ describe HammerCLIForeman::Settings do
|
|
38
40
|
context "parameters" do
|
39
41
|
it_should_accept "name", ["--name=setting1", "--value=setting2"]
|
40
42
|
it_should_accept "id", ["--id=1", "--value=setting2"]
|
43
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
44
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
41
45
|
end
|
42
46
|
|
43
47
|
end
|
data/test/unit/usergroup_test.rb
CHANGED
@@ -18,6 +18,8 @@ describe HammerCLIForeman::Usergroup do
|
|
18
18
|
context "parameters" do
|
19
19
|
it_should_accept "no arguments"
|
20
20
|
it_should_accept_search_params
|
21
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
22
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
21
23
|
end
|
22
24
|
|
23
25
|
context "output" do
|
@@ -35,6 +37,8 @@ describe HammerCLIForeman::Usergroup do
|
|
35
37
|
context "parameters" do
|
36
38
|
it_should_accept "id", ["--id=1"]
|
37
39
|
it_should_accept "name", ["--name=ug"]
|
40
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
41
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
38
42
|
end
|
39
43
|
|
40
44
|
context "output" do
|
@@ -58,6 +62,8 @@ describe HammerCLIForeman::Usergroup do
|
|
58
62
|
context "parameters" do
|
59
63
|
it_should_accept "name", ["--name=ug"]
|
60
64
|
it_should_accept "name, role ids, user group ids and user ids", ["--name=ug", "--role-ids=1,2,3", "--user-group-ids=1,2,3", "--user-ids=1,2,3"]
|
65
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
66
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
61
67
|
end
|
62
68
|
end
|
63
69
|
|
@@ -68,6 +74,8 @@ describe HammerCLIForeman::Usergroup do
|
|
68
74
|
context "parameters" do
|
69
75
|
it_should_accept "name", ["--name=ug"]
|
70
76
|
it_should_accept "id", ["--id=1"]
|
77
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
78
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
71
79
|
end
|
72
80
|
end
|
73
81
|
|
@@ -80,6 +88,8 @@ describe HammerCLIForeman::Usergroup do
|
|
80
88
|
it_should_accept "id", ["--id=1"]
|
81
89
|
it_should_accept "name and new name", ["--name=ug", "--new-name=ug2"]
|
82
90
|
it_should_accept "id, new name, role ids, user group ids and user ids", ["--id=1", "--new-name=ug", "--role-ids=1,2,3", "--user-group-ids=1,2,3", "--user-ids=1,2,3"]
|
91
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
92
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
83
93
|
end
|
84
94
|
end
|
85
95
|
end
|