hammer_cli_foreman 3.7.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/doc/host_create.md +0 -6
- data/doc/release_notes.md +15 -0
- data/lib/hammer_cli_foreman/command_extensions/ping.rb +14 -0
- data/lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb +0 -1
- data/lib/hammer_cli_foreman/ping.rb +6 -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/ping_test.rb +25 -0
- 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 +31 -30
- data/lib/hammer_cli_foreman/compute_resource/rackspace.rb +0 -25
data/test/unit/hostgroup_test.rb
CHANGED
@@ -7,19 +7,19 @@ describe HammerCLIForeman::Hostgroup do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:hostgroups, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::Hostgroup::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
|
end
|
21
21
|
|
22
|
-
|
22
|
+
describe "output" do
|
23
23
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
24
24
|
|
25
25
|
it_should_print_n_records
|
@@ -29,16 +29,16 @@ describe HammerCLIForeman::Hostgroup do
|
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
describe "InfoCommand" do
|
33
33
|
|
34
34
|
let(:cmd) { HammerCLIForeman::Hostgroup::InfoCommand.new("", ctx) }
|
35
35
|
|
36
|
-
|
36
|
+
describe "parameters" do
|
37
37
|
it_should_accept "id", ["--id=1"]
|
38
38
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
describe "output" do
|
42
42
|
with_params ["--id=1"] do
|
43
43
|
it_should_print_n_records 1
|
44
44
|
it_should_print_columns ["Id", "Name", "Title"]
|
@@ -49,22 +49,22 @@ describe HammerCLIForeman::Hostgroup do
|
|
49
49
|
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
describe "DeleteCommand" do
|
53
53
|
|
54
54
|
let(:cmd) { HammerCLIForeman::Hostgroup::DeleteCommand.new("", ctx) }
|
55
55
|
|
56
|
-
|
56
|
+
describe "parameters" do
|
57
57
|
it_should_accept "id", ["--id=1"]
|
58
58
|
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
describe "CreateCommand" do
|
64
64
|
|
65
65
|
let(:cmd) { HammerCLIForeman::Hostgroup::CreateCommand.new("", ctx) }
|
66
66
|
|
67
|
-
|
67
|
+
describe "parameters" do
|
68
68
|
it_should_accept "name, parent_id, architecture_id, domain_id, operatingsystem_id and more",
|
69
69
|
["--name=hostgroup", "--parent-id=1", "--architecture-id=1", "--domain-id=1",
|
70
70
|
"--operatingsystem-id=1", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1", '--root-password=foreman']
|
@@ -74,11 +74,11 @@ describe HammerCLIForeman::Hostgroup do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
|
77
|
+
describe "UpdateCommand" do
|
78
78
|
|
79
79
|
let(:cmd) { HammerCLIForeman::Hostgroup::UpdateCommand.new("", ctx) }
|
80
80
|
|
81
|
-
|
81
|
+
describe "parameters" do
|
82
82
|
it_should_accept "name, parent_id, architecture_id, domain_id, operatingsystem_id and more",
|
83
83
|
["--id=1 --name=hostgroup2 --title=default/hostgroup2", "--parent-id=1", "--architecture-id=1", "--domain-id=1",
|
84
84
|
"--operatingsystem-id=1", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1", '--root-password=foreman']
|
@@ -90,7 +90,7 @@ describe HammerCLIForeman::Hostgroup do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
|
93
|
-
|
93
|
+
describe "SetParameterCommand" do
|
94
94
|
|
95
95
|
before :each do
|
96
96
|
ResourceMocks.parameters_index
|
@@ -98,7 +98,7 @@ describe HammerCLIForeman::Hostgroup do
|
|
98
98
|
|
99
99
|
let(:cmd) { HammerCLIForeman::Hostgroup::SetParameterCommand.new("", ctx) }
|
100
100
|
|
101
|
-
|
101
|
+
describe "parameters" do
|
102
102
|
it_should_accept "name, value, parameter-type and hostgroup id", ["--name=name", "--parameter-type=string", "--value=val", "--hostgroup-id=1"]
|
103
103
|
it_should_fail_with "name missing", ["--value=val", "--hostgroup-id=1"]
|
104
104
|
it_should_fail_with "value missing", ["--name=name", "--hostgroup-id=1"]
|
@@ -108,11 +108,11 @@ describe HammerCLIForeman::Hostgroup do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
|
111
|
-
|
111
|
+
describe "DeleteParameterCommand" do
|
112
112
|
|
113
113
|
let(:cmd) { HammerCLIForeman::Hostgroup::DeleteParameterCommand.new("", ctx) }
|
114
114
|
|
115
|
-
|
115
|
+
describe "parameters" do
|
116
116
|
it_should_accept "name and hostgroup id", ["--name=param", "--hostgroup-id=1"]
|
117
117
|
# it_should_fail_with "name missing", ["--hostgroup-id=id"]
|
118
118
|
# it_should_fail_with "hostgroup id missing", ["--name=param"]
|
@@ -121,11 +121,11 @@ describe HammerCLIForeman::Hostgroup do
|
|
121
121
|
|
122
122
|
end
|
123
123
|
|
124
|
-
|
124
|
+
describe "RebuildConfigCommand" do
|
125
125
|
|
126
126
|
let(:cmd) { HammerCLIForeman::Hostgroup::RebuildConfigCommand.new("", ctx) }
|
127
127
|
|
128
|
-
|
128
|
+
describe "parameters" do
|
129
129
|
it_should_accept "name", ["--name=host"]
|
130
130
|
it_should_accept "id", ["--id=1"]
|
131
131
|
# it_should_fail_with "no arguments"
|
data/test/unit/image_test.rb
CHANGED
@@ -9,20 +9,20 @@ describe HammerCLIForeman::Image do
|
|
9
9
|
|
10
10
|
include CommandTestHelper
|
11
11
|
|
12
|
-
|
12
|
+
describe "ListCommand" do
|
13
13
|
before do
|
14
14
|
ResourceMocks.mock_action_call(:images, :index, [])
|
15
15
|
end
|
16
16
|
|
17
17
|
let(:cmd) { HammerCLIForeman::Image::ListCommand.new("", ctx) }
|
18
18
|
|
19
|
-
|
19
|
+
describe "parameters" do
|
20
20
|
it_should_accept "compute resource name", ["--compute-resource=cr"]
|
21
21
|
it_should_accept "compute resource id", ["--compute-resource-id=1"]
|
22
22
|
#it_should_accept_search_params
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
describe "output" do
|
26
26
|
let(:expected_record_count) { count_records(cmd.resource.call(:index, :compute_resource_id=>1)) }
|
27
27
|
|
28
28
|
with_params ["--compute-resource-id=1"] do
|
@@ -37,16 +37,16 @@ describe HammerCLIForeman::Image do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
|
40
|
-
|
40
|
+
describe "InfoCommand" do
|
41
41
|
|
42
42
|
let(:cmd) { HammerCLIForeman::Image::InfoCommand.new("", ctx) }
|
43
43
|
|
44
|
-
|
44
|
+
describe "parameters" do
|
45
45
|
it_should_accept "compute resource name and image's uuid", ["--compute-resource=cr", "--id=1"]
|
46
46
|
it_should_accept "compute resource id and image's uuid", ["--compute-resource-id=1", "--id=1"]
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
describe "output" do
|
50
50
|
let(:expected_record_count) { cmd.resource.call(:index).length }
|
51
51
|
|
52
52
|
with_params ["--compute-resource-id=1", "--id=1"] do
|
@@ -62,7 +62,7 @@ describe HammerCLIForeman::Image do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
describe "AvailableImagesCommand" do
|
66
66
|
|
67
67
|
let(:cmd) { HammerCLIForeman::Image::AvailableImagesCommand.new("", ctx) }
|
68
68
|
|
@@ -71,12 +71,12 @@ describe HammerCLIForeman::Image do
|
|
71
71
|
ResourceMocks.compute_resources_available_images
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
describe "parameters" do
|
75
75
|
it_should_accept "compute resource name", ["--compute-resource=cr"]
|
76
76
|
it_should_accept "compute resource id", ["--compute-resource-id=1"]
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
describe "output" do
|
80
80
|
with_params ["--compute-resource-id=1"] do
|
81
81
|
it_should_print_column "Name"
|
82
82
|
it_should_print_column "UUID"
|
@@ -84,11 +84,11 @@ describe HammerCLIForeman::Image do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
|
87
|
+
describe "CreateCommand" do
|
88
88
|
|
89
89
|
let(:cmd) { HammerCLIForeman::Image::CreateCommand.new("", ctx) }
|
90
90
|
|
91
|
-
|
91
|
+
describe "parameters" do
|
92
92
|
it_should_accept "all required params", ["--name=img", "--operatingsystem-id=1", "--architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
|
93
93
|
it_should_accept "all required params and resource's name", ["--name=img", "--operatingsystem-id=1", "--architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource=ec2"]
|
94
94
|
# it_should_fail_with "name missing", ["--operatingsystem-id=1", "architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
|
@@ -102,11 +102,11 @@ describe HammerCLIForeman::Image do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
|
105
|
-
|
105
|
+
describe "DeleteCommand" do
|
106
106
|
|
107
107
|
let(:cmd) { HammerCLIForeman::Image::DeleteCommand.new("", ctx) }
|
108
108
|
|
109
|
-
|
109
|
+
describe "parameters" do
|
110
110
|
it_should_accept "id and resource's id", ["--id=1", "--compute-resource-id=1"]
|
111
111
|
it_should_accept "id and resource's name", ["--id=1", "--compute-resource=ec2"]
|
112
112
|
# it_should_fail_with "id missing", ["--compute-resource-id=1"]
|
@@ -117,11 +117,11 @@ describe HammerCLIForeman::Image do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
|
120
|
-
|
120
|
+
describe "UpdateCommand" do
|
121
121
|
|
122
122
|
let(:cmd) { HammerCLIForeman::Image::UpdateCommand.new("", ctx) }
|
123
123
|
|
124
|
-
|
124
|
+
describe "parameters" do
|
125
125
|
it_should_accept "id and resource's id", ["--id=1", "--compute-resource-id=1"]
|
126
126
|
it_should_accept "id and resource's name", ["--id=1", "--compute-resource=ec2"]
|
127
127
|
it_should_accept "all available params", ["--id=1", "--name=img", "--operatingsystem-id=1", "--architecture-id=1", "--username=root", "--uuid=aabbcc123", "--compute-resource-id=1"]
|
data/test/unit/location_test.rb
CHANGED
@@ -8,7 +8,7 @@ describe HammerCLIForeman::Location do
|
|
8
8
|
include CommandTestHelper
|
9
9
|
extend ResourceDisabled
|
10
10
|
|
11
|
-
|
11
|
+
describe "ListCommand" do
|
12
12
|
|
13
13
|
let(:cmd) { HammerCLIForeman::Location::ListCommand.new("", ctx) }
|
14
14
|
|
@@ -16,12 +16,12 @@ describe HammerCLIForeman::Location do
|
|
16
16
|
ResourceMocks.locations_index
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
describe "parameters" do
|
20
20
|
it_should_accept "no arguments"
|
21
21
|
it_should_accept_search_params
|
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
|
@@ -34,7 +34,7 @@ describe HammerCLIForeman::Location do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
|
37
|
-
|
37
|
+
describe "InfoCommand" do
|
38
38
|
|
39
39
|
let(:cmd) { HammerCLIForeman::Location::InfoCommand.new("", ctx) }
|
40
40
|
|
@@ -42,13 +42,13 @@ describe HammerCLIForeman::Location do
|
|
42
42
|
ResourceMocks.locations_show
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
describe "parameters" do
|
46
46
|
it_should_accept "id", ["--id=1"]
|
47
47
|
it_should_accept "name", ["--name=arch"]
|
48
48
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
describe "output" do
|
52
52
|
with_params ["--id=1"] do
|
53
53
|
it_should_print_n_records 1
|
54
54
|
it_should_print_column "Name"
|
@@ -65,11 +65,11 @@ describe HammerCLIForeman::Location do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
|
68
|
-
|
68
|
+
describe "CreateCommand" do
|
69
69
|
|
70
70
|
let(:cmd) { HammerCLIForeman::Location::CreateCommand.new("", ctx) }
|
71
71
|
|
72
|
-
|
72
|
+
describe "parameters" do
|
73
73
|
it_should_accept "name", ["--name=org"]
|
74
74
|
# it_should_fail_with "name missing", []
|
75
75
|
# TODO: temporarily disabled, parameters are checked in the api
|
@@ -81,11 +81,11 @@ describe HammerCLIForeman::Location do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
|
84
|
-
|
84
|
+
describe "DeleteCommand" do
|
85
85
|
|
86
86
|
let(:cmd) { HammerCLIForeman::Location::DeleteCommand.new("", ctx) }
|
87
87
|
|
88
|
-
|
88
|
+
describe "parameters" do
|
89
89
|
it_should_accept "name", ["--name=org"]
|
90
90
|
it_should_accept "id", ["--id=1"]
|
91
91
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -97,11 +97,11 @@ describe HammerCLIForeman::Location do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
|
100
|
-
|
100
|
+
describe "UpdateCommand" do
|
101
101
|
|
102
102
|
let(:cmd) { HammerCLIForeman::Location::UpdateCommand.new("", ctx) }
|
103
103
|
|
104
|
-
|
104
|
+
describe "parameters" do
|
105
105
|
it_should_accept "name", ["--name=org", "--new-name=org2"]
|
106
106
|
it_should_accept "id", ["--id=1", "--new-name=org2"]
|
107
107
|
# it_should_fail_with "no params", []
|
@@ -8,20 +8,20 @@ require 'hammer_cli_foreman/mail_notification'
|
|
8
8
|
describe HammerCLIForeman::MailNotification do
|
9
9
|
include CommandTestHelper
|
10
10
|
|
11
|
-
|
11
|
+
describe 'ListCommand' do
|
12
12
|
before :each do
|
13
13
|
ResourceMocks.mail_notifications
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:cmd) { HammerCLIForeman::MailNotification::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
|
@@ -30,17 +30,17 @@ describe HammerCLIForeman::MailNotification do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
describe 'InfoCommand' do
|
34
34
|
let(:cmd) { HammerCLIForeman::MailNotification::InfoCommand.new('', ctx) }
|
35
35
|
|
36
|
-
|
36
|
+
describe 'parameters' do
|
37
37
|
it_should_accept 'id', ['--id=1']
|
38
38
|
it_should_accept 'name', ['--name=test']
|
39
39
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
40
40
|
it_should_accept 'location', %w[--id=1 --location-id=1]
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
describe 'output' do
|
44
44
|
with_params ['--id=1'] do
|
45
45
|
it_should_print_n_records 1
|
46
46
|
it_should_print_column 'Id'
|
data/test/unit/media_test.rb
CHANGED
@@ -7,19 +7,19 @@ describe HammerCLIForeman::Medium do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:media, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::Medium::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
|
end
|
21
21
|
|
22
|
-
|
22
|
+
describe "output" do
|
23
23
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
24
24
|
|
25
25
|
it_should_print_n_records
|
@@ -30,17 +30,17 @@ describe HammerCLIForeman::Medium do
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
describe "InfoCommand" do
|
34
34
|
|
35
35
|
let(:cmd) { HammerCLIForeman::Medium::InfoCommand.new("", ctx) }
|
36
36
|
|
37
|
-
|
37
|
+
describe "parameters" do
|
38
38
|
it_should_accept "id", ["--id=1"]
|
39
39
|
it_should_accept "name", ["--name=medium_x"]
|
40
40
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
describe "output" do
|
44
44
|
with_params ["--id=1"] do
|
45
45
|
it_should_print_n_records 1
|
46
46
|
it_should_print_column "Name"
|
@@ -54,11 +54,11 @@ describe HammerCLIForeman::Medium do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
describe "CreateCommand" do
|
58
58
|
|
59
59
|
let(:cmd) { HammerCLIForeman::Medium::CreateCommand.new("", ctx) }
|
60
60
|
|
61
|
-
|
61
|
+
describe "parameters" do
|
62
62
|
it_should_accept "name, path, os ids", ["--name=media", "--path=http://some.path/abc/$major/Fedora/$arch/", "--operatingsystem-ids=1,2"]
|
63
63
|
# it_should_fail_with "name missing", ["--path=http://some.path/abc/$major/Fedora/$arch/"]
|
64
64
|
# it_should_fail_with "path missing", ["--name=media"]
|
@@ -70,22 +70,22 @@ describe HammerCLIForeman::Medium do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
describe "DeleteCommand" do
|
74
74
|
|
75
75
|
let(:cmd) { HammerCLIForeman::Medium::DeleteCommand.new("", ctx) }
|
76
76
|
|
77
|
-
|
77
|
+
describe "parameters" do
|
78
78
|
it_should_accept "name", ["--name=media"]
|
79
79
|
it_should_accept "id", ["--id=1"]
|
80
80
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
|
84
|
+
describe "UpdateCommand" do
|
85
85
|
|
86
86
|
let(:cmd) { HammerCLIForeman::Medium::UpdateCommand.new("", ctx) }
|
87
87
|
|
88
|
-
|
88
|
+
describe "parameters" do
|
89
89
|
it_should_accept "name", ["--name=medium"]
|
90
90
|
it_should_accept "id", ["--id=1"]
|
91
91
|
it_should_accept "os ids", ["--id=1", "--operatingsystem-ids=1,2"]
|
data/test/unit/model_test.rb
CHANGED
@@ -8,21 +8,21 @@ describe HammerCLIForeman::Model do
|
|
8
8
|
|
9
9
|
include CommandTestHelper
|
10
10
|
|
11
|
-
|
11
|
+
describe 'ListCommand' do
|
12
12
|
before do
|
13
13
|
ResourceMocks.mock_action_call(:models, :index, [])
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:cmd) { HammerCLIForeman::Model::ListCommand.new('', ctx) }
|
17
17
|
|
18
|
-
|
18
|
+
describe 'parameters' do
|
19
19
|
it_should_accept 'no arguments'
|
20
20
|
it_should_accept_search_params
|
21
21
|
it_should_accept 'organization', ['--organization-id=1']
|
22
22
|
it_should_accept 'location', ['--location-id=1']
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
describe 'output' do
|
26
26
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
27
27
|
|
28
28
|
it_should_print_n_records
|
@@ -34,11 +34,11 @@ describe HammerCLIForeman::Model do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
|
37
|
-
|
37
|
+
describe 'InfoCommand' do
|
38
38
|
|
39
39
|
let(:cmd) { HammerCLIForeman::Model::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=model']
|
44
44
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -46,7 +46,7 @@ describe HammerCLIForeman::Model do
|
|
46
46
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
describe 'output' do
|
50
50
|
with_params ['--id=1'] do
|
51
51
|
it_should_print_n_records 1
|
52
52
|
it_should_print_column 'Name'
|
@@ -62,11 +62,11 @@ describe HammerCLIForeman::Model do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
|
65
|
-
|
65
|
+
describe 'CreateCommand' do
|
66
66
|
|
67
67
|
let(:cmd) { HammerCLIForeman::Model::CreateCommand.new('', ctx) }
|
68
68
|
|
69
|
-
|
69
|
+
describe 'parameters' do
|
70
70
|
it_should_accept 'name, info, vendor-class, hardware-model, organization, location',
|
71
71
|
%w[--name=model --info=description --vendor-class=class --hardware-model=model --organization-id=1 --location-id=1]
|
72
72
|
# it_should_fail_with "name missing", ["--info=description", "--vendor-class=class", "--hardware-model=model"]
|
@@ -76,11 +76,11 @@ describe HammerCLIForeman::Model do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
|
79
|
-
|
79
|
+
describe 'DeleteCommand' do
|
80
80
|
|
81
81
|
let(:cmd) { HammerCLIForeman::Model::DeleteCommand.new('', ctx) }
|
82
82
|
|
83
|
-
|
83
|
+
describe 'parameters' do
|
84
84
|
it_should_accept 'name', ['--name=model']
|
85
85
|
it_should_accept 'id', ['--id=1']
|
86
86
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -91,11 +91,11 @@ describe HammerCLIForeman::Model do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
|
94
|
-
|
94
|
+
describe 'UpdateCommand' do
|
95
95
|
|
96
96
|
let(:cmd) { HammerCLIForeman::Model::UpdateCommand.new('', ctx) }
|
97
97
|
|
98
|
-
|
98
|
+
describe 'parameters' do
|
99
99
|
it_should_accept 'name', ['--name=model', '--new-name=model2', '--info=description', '--vendor-class=class', '--hardware-model=model']
|
100
100
|
it_should_accept 'id', ['--id=1', '--new-name=model2', '--info=description', '--vendor-class=class', '--hardware-model=model']
|
101
101
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -7,7 +7,7 @@ describe HammerCLIForeman::OperatingSystem do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
|
12
12
|
before :each do
|
13
13
|
ResourceMocks.operatingsystems
|
@@ -15,14 +15,14 @@ describe HammerCLIForeman::OperatingSystem do
|
|
15
15
|
|
16
16
|
let(:cmd) { HammerCLIForeman::OperatingSystem::ListCommand.new("", ctx) }
|
17
17
|
|
18
|
-
|
18
|
+
describe "parameters" do
|
19
19
|
it_should_accept "no arguments"
|
20
20
|
it_should_accept_search_params
|
21
21
|
it_should_accept 'organization', ['--organization-id=1']
|
22
22
|
it_should_accept 'location', ['--location-id=1']
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
describe "output" do
|
26
26
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
27
27
|
|
28
28
|
it_should_print_n_records
|
@@ -35,11 +35,11 @@ describe HammerCLIForeman::OperatingSystem do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
|
38
|
-
|
38
|
+
describe "InfoCommand" do
|
39
39
|
|
40
40
|
let(:cmd) { HammerCLIForeman::OperatingSystem::InfoCommand.new("", ctx) }
|
41
41
|
|
42
|
-
|
42
|
+
describe "parameters" do
|
43
43
|
it_should_accept "id", ["--id=1"]
|
44
44
|
it_should_accept "title", ["--title=Rhel 6.5"]
|
45
45
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -47,7 +47,7 @@ describe HammerCLIForeman::OperatingSystem do
|
|
47
47
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
describe "output" do
|
51
51
|
with_params ["--id=1"] do
|
52
52
|
it_should_print_n_records 1
|
53
53
|
it_should_print_column "Name"
|
@@ -68,11 +68,11 @@ describe HammerCLIForeman::OperatingSystem do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
|
71
|
-
|
71
|
+
describe "CreateCommand" do
|
72
72
|
|
73
73
|
let(:cmd) { HammerCLIForeman::OperatingSystem::CreateCommand.new("", ctx) }
|
74
74
|
|
75
|
-
|
75
|
+
describe "parameters" do
|
76
76
|
it_should_accept "name, major, minor, family, release name, organization, location",
|
77
77
|
["--name=media", "--major=1", "--minor=2", "--family=Red Hat", "--release-name=awesome", "--organization-id=1", "--location-id=1"]
|
78
78
|
# it_should_fail_with "name missing", ["--major=1", "--minor=2", "--family=Red Hat", "--release-name=awesome"]
|
@@ -85,11 +85,11 @@ describe HammerCLIForeman::OperatingSystem do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
|
88
|
-
|
88
|
+
describe "DeleteCommand" do
|
89
89
|
|
90
90
|
let(:cmd) { HammerCLIForeman::OperatingSystem::DeleteCommand.new("", ctx) }
|
91
91
|
|
92
|
-
|
92
|
+
describe "parameters" do
|
93
93
|
it_should_accept "id", ["--id=1"]
|
94
94
|
it_should_accept "title", ["--title=Rhel 6.5"]
|
95
95
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -101,11 +101,11 @@ describe HammerCLIForeman::OperatingSystem do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
|
104
|
-
|
104
|
+
describe "UpdateCommand" do
|
105
105
|
|
106
106
|
let(:cmd) { HammerCLIForeman::OperatingSystem::UpdateCommand.new("", ctx) }
|
107
107
|
|
108
|
-
|
108
|
+
describe "parameters" do
|
109
109
|
it_should_accept "id", ["--id=1"]
|
110
110
|
it_should_accept "title", ["--title=Rhel 6.5"]
|
111
111
|
it_should_accept "name, major, minor, family, release name, organization, location",
|
@@ -122,7 +122,7 @@ describe HammerCLIForeman::OperatingSystem do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
|
125
|
-
|
125
|
+
describe "SetParameterCommand" do
|
126
126
|
|
127
127
|
before :each do
|
128
128
|
ResourceMocks.operatingsystems
|
@@ -130,7 +130,7 @@ describe HammerCLIForeman::OperatingSystem do
|
|
130
130
|
|
131
131
|
let(:cmd) { HammerCLIForeman::OperatingSystem::SetParameterCommand.new("", ctx) }
|
132
132
|
|
133
|
-
|
133
|
+
describe "parameters" do
|
134
134
|
it_should_accept "name, value and os id", ["--name=domain", "--value=val", "--operatingsystem-id=1"]
|
135
135
|
it_should_accept "name, value and os title", ["--name=domain", "--value=val", "--operatingsystem=Rhel 6.5"]
|
136
136
|
it_should_accept "name, value, type and os id", ["--name=domain", "--value=val", "--parameter-type=string", "--operatingsystem-id=1"]
|
@@ -143,11 +143,11 @@ describe HammerCLIForeman::OperatingSystem do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
|
146
|
-
|
146
|
+
describe "DeleteParameterCommand" do
|
147
147
|
|
148
148
|
let(:cmd) { HammerCLIForeman::OperatingSystem::DeleteParameterCommand.new("", ctx) }
|
149
149
|
|
150
|
-
|
150
|
+
describe "parameters" do
|
151
151
|
it_should_accept "name and os id", ["--name=domain", "--operatingsystem-id=1"]
|
152
152
|
it_should_accept "name and os title", ["--name=domain", "--operatingsystem=Rhel 6.5"]
|
153
153
|
# it_should_fail_with "name missing", ["--operatingsystem-id=id"]
|