hammer_cli_foreman 3.7.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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',
|
data/test/unit/commands_test.rb
CHANGED
@@ -7,7 +7,7 @@ describe HammerCLIForeman do
|
|
7
7
|
HammerCLI::Settings.load({:_params => {:interactive => false}})
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
describe "collection_to_common_format" do
|
11
11
|
|
12
12
|
let(:kind) { { "name" => "PXELinux", "id" => 1 } }
|
13
13
|
|
@@ -57,7 +57,7 @@ describe HammerCLIForeman do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
|
60
|
-
|
60
|
+
describe "record_to_common_format" do
|
61
61
|
|
62
62
|
let(:arch) { { "name" => "x86_64", "id" => 1 } }
|
63
63
|
|
@@ -79,7 +79,7 @@ describe HammerCLIForeman do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
|
82
|
+
describe "Create command" do
|
83
83
|
it "should format created entity in csv output" do
|
84
84
|
ResourceMocks.mock_action_call(:architectures, :create, {
|
85
85
|
"architecture" => {
|
@@ -96,7 +96,7 @@ describe HammerCLIForeman do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
|
99
|
+
describe "AddAssociatedCommand" do
|
100
100
|
it "should associate resource" do
|
101
101
|
ResourceMocks.mock_action_calls(
|
102
102
|
[:organizations, :show, { "id" => 1, "domain_ids" => [2] }],
|
@@ -132,7 +132,7 @@ describe HammerCLIForeman do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
-
|
135
|
+
describe "ListSearchCommand" do
|
136
136
|
it "should find correct results" do
|
137
137
|
ResourceMocks.mock_action_calls(
|
138
138
|
[:hosts, :index, [{ "id" => 2, "name" => "random-host", "ip" => "192.168.100.112", "mac" => "6e:4b:3c:2c:8a:0a" }]],
|
@@ -7,19 +7,19 @@ describe HammerCLIForeman::CommonParameter do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:common_parameters, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::CommonParameter::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,21 +29,21 @@ describe HammerCLIForeman::CommonParameter do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
|
32
|
-
|
32
|
+
describe "SetCommand" do
|
33
33
|
before do
|
34
34
|
ResourceMocks.common_parameter_list
|
35
35
|
end
|
36
36
|
|
37
37
|
let(:cmd) { HammerCLIForeman::CommonParameter::SetCommand.new("", ctx) }
|
38
38
|
|
39
|
-
|
39
|
+
describe "parameters" do
|
40
40
|
it_should_accept "name, value, parameter-type and hidden-value", ["--name=param", "--value=val", "--parameter-type=string", "--hidden-value=true"]
|
41
41
|
# it_should_fail_with "name missing", ["--value=val"]
|
42
42
|
# it_should_fail_with "value missing", ["--name=param"]
|
43
43
|
# TODO: temporarily disabled, parameters are checked by the api
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
describe "adding params" do
|
47
47
|
before :each do
|
48
48
|
ResourceMocks.mock_action_calls(
|
49
49
|
[:common_parameters, :index, []],
|
@@ -56,7 +56,7 @@ describe HammerCLIForeman::CommonParameter do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
describe "updating params" do
|
60
60
|
before :each do
|
61
61
|
ResourceMocks.mock_action_calls(
|
62
62
|
[:common_parameters, :index, [{'name' => 'param', 'value' => 'test'}]],
|
@@ -70,7 +70,7 @@ describe HammerCLIForeman::CommonParameter do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
describe "adding params with parameter type" do
|
74
74
|
before :each do
|
75
75
|
ResourceMocks.mock_action_calls(
|
76
76
|
[:common_parameters, :index, []],
|
@@ -85,11 +85,11 @@ describe HammerCLIForeman::CommonParameter do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
|
88
|
-
|
88
|
+
describe "DeleteCommand" do
|
89
89
|
|
90
90
|
let(:cmd) { HammerCLIForeman::CommonParameter::DeleteCommand.new("", ctx) }
|
91
91
|
|
92
|
-
|
92
|
+
describe "parameters" do
|
93
93
|
it_should_accept "name", ["--name=arch"]
|
94
94
|
# it_should_fail_with "name missing", []
|
95
95
|
# TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -8,20 +8,20 @@ require 'hammer_cli_foreman/compute_profile'
|
|
8
8
|
describe HammerCLIForeman::ComputeProfile do
|
9
9
|
include CommandTestHelper
|
10
10
|
|
11
|
-
|
11
|
+
describe 'ListCommand' do
|
12
12
|
before :each do
|
13
13
|
ResourceMocks.compute_profiles
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:cmd) { HammerCLIForeman::ComputeProfile::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::ComputeProfile do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
describe 'InfoCommand' do
|
34
34
|
let(:cmd) { HammerCLIForeman::ComputeProfile::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'
|
@@ -52,10 +52,10 @@ describe HammerCLIForeman::ComputeProfile do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
describe 'CreateCommand' do
|
56
56
|
let(:cmd) { HammerCLIForeman::ComputeProfile::CreateCommand.new('', ctx) }
|
57
57
|
|
58
|
-
|
58
|
+
describe 'parameters' do
|
59
59
|
it_should_accept 'name', ['--name=test']
|
60
60
|
it_should_accept 'organization', %w[--name=test --organization-id=1]
|
61
61
|
it_should_accept 'location', %w[--name=test --location-id=1]
|
@@ -63,10 +63,10 @@ describe HammerCLIForeman::ComputeProfile do
|
|
63
63
|
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
describe 'DeleteCommand' do
|
67
67
|
let(:cmd) { HammerCLIForeman::ComputeProfile::DeleteCommand.new('', ctx) }
|
68
68
|
|
69
|
-
|
69
|
+
describe 'parameters' do
|
70
70
|
it_should_accept 'id', ['--id=1']
|
71
71
|
it_should_accept 'name', ['--name=test']
|
72
72
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -74,10 +74,10 @@ describe HammerCLIForeman::ComputeProfile do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
|
77
|
+
describe 'UpdateCommand' do
|
78
78
|
let(:cmd) { HammerCLIForeman::ComputeProfile::UpdateCommand.new('', ctx) }
|
79
79
|
|
80
|
-
|
80
|
+
describe 'parameters' do
|
81
81
|
it_should_accept 'id', ['--id=1']
|
82
82
|
it_should_accept 'name', ['--name=test']
|
83
83
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -8,19 +8,19 @@ describe HammerCLIForeman::ComputeResource do
|
|
8
8
|
|
9
9
|
include CommandTestHelper
|
10
10
|
|
11
|
-
|
11
|
+
describe "ListCommand" do
|
12
12
|
before do
|
13
13
|
ResourceMocks.mock_action_call(:compute_resources, :index, [])
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:cmd) { HammerCLIForeman::ComputeResource::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
|
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
|
@@ -30,20 +30,20 @@ describe HammerCLIForeman::ComputeResource do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
|
33
|
-
|
33
|
+
describe "InfoCommand" do
|
34
34
|
before do
|
35
35
|
ResourceMocks.compute_resource_show
|
36
36
|
end
|
37
37
|
|
38
38
|
let(:cmd) { HammerCLIForeman::ComputeResource::InfoCommand.new("", ctx) }
|
39
39
|
|
40
|
-
|
40
|
+
describe "parameters" do
|
41
41
|
it_should_accept "id", ["--id=1"]
|
42
42
|
it_should_accept "name", ["--name=arch"]
|
43
43
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
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_columns ["Name", "Id", "Provider", "Url"]
|
@@ -53,11 +53,11 @@ describe HammerCLIForeman::ComputeResource do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
|
56
|
+
describe "CreateCommand" do
|
57
57
|
|
58
58
|
let(:cmd) { HammerCLIForeman::ComputeResource::CreateCommand.new("", ctx) }
|
59
59
|
|
60
|
-
|
60
|
+
describe "parameters" do
|
61
61
|
it_should_accept "name, url, provider", ["--name=arch", "--url=http://some.org", "--provider=Libvirt"]
|
62
62
|
# it_should_fail_with "name missing", ["--url=http://some.org", "--provider=Libvirt"]
|
63
63
|
# it_should_fail_with "url missing", ["--name=arch", "--provider=Libvirt"]
|
@@ -68,11 +68,11 @@ describe HammerCLIForeman::ComputeResource do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
|
71
|
-
|
71
|
+
describe "DeleteCommand" do
|
72
72
|
|
73
73
|
let(:cmd) { HammerCLIForeman::ComputeResource::DeleteCommand.new("", ctx) }
|
74
74
|
|
75
|
-
|
75
|
+
describe "parameters" do
|
76
76
|
it_should_accept "name", ["--name=arch"]
|
77
77
|
it_should_accept "id", ["--id=1"]
|
78
78
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -81,11 +81,11 @@ describe HammerCLIForeman::ComputeResource do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
|
84
|
-
|
84
|
+
describe "UpdateCommand" do
|
85
85
|
|
86
86
|
let(:cmd) { HammerCLIForeman::ComputeResource::UpdateCommand.new("", ctx) }
|
87
87
|
|
88
|
-
|
88
|
+
describe "parameters" do
|
89
89
|
it_should_accept "name", ["--name=arch", "--new-name=arch2"]
|
90
90
|
it_should_accept "id", ["--id=1", "--new-name=arch2"]
|
91
91
|
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -94,19 +94,19 @@ describe HammerCLIForeman::ComputeResource do
|
|
94
94
|
|
95
95
|
end
|
96
96
|
|
97
|
-
|
97
|
+
describe "AvailableClustersCommand" do
|
98
98
|
before do
|
99
99
|
ResourceMocks.compute_resources_available_clusters
|
100
100
|
end
|
101
101
|
|
102
102
|
let(:cmd) { HammerCLIForeman::ComputeResource::AvailableClustersCommand.new("", ctx) }
|
103
103
|
|
104
|
-
|
104
|
+
describe "parameters" do
|
105
105
|
it_should_accept "id", ["--id=1"]
|
106
106
|
it_should_accept "name", ["--name=domain-c7"]
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
describe "output" do
|
110
110
|
let(:expected_record_count) { count_records(cmd.resource.call(:available_clusters)) }
|
111
111
|
|
112
112
|
with_params ["--name=testcr"] do
|
@@ -116,21 +116,21 @@ describe HammerCLIForeman::ComputeResource do
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
|
119
|
+
describe "AvailableNetworksCommand" do
|
120
120
|
before do
|
121
121
|
ResourceMocks.compute_resources_available_networks
|
122
122
|
end
|
123
123
|
|
124
124
|
let(:cmd) { HammerCLIForeman::ComputeResource::AvailableNetworksCommand.new("", ctx) }
|
125
125
|
|
126
|
-
|
126
|
+
describe "parameters" do
|
127
127
|
it_should_accept "id", ["--id=1"]
|
128
128
|
it_should_accept "name", ["--name=arch"]
|
129
129
|
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
130
130
|
# it_should_fail_with "name or id missing", ["--new-name=arch2"] # TODO: temporarily disabled, parameters are checked in the id resolver
|
131
131
|
end
|
132
132
|
|
133
|
-
|
133
|
+
describe "output" do
|
134
134
|
let(:expected_record_count) { count_records(cmd.resource.call(:available_networks)) }
|
135
135
|
|
136
136
|
with_params ["--name=testcr"] do
|
@@ -7,19 +7,19 @@ describe HammerCLIForeman::ConfigReport do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:config_reports, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::ConfigReport::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
|
@@ -38,11 +38,11 @@ describe HammerCLIForeman::ConfigReport do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
|
41
|
-
|
41
|
+
describe "InfoCommand" do
|
42
42
|
|
43
43
|
let(:cmd) { HammerCLIForeman::ConfigReport::InfoCommand.new("", ctx) }
|
44
44
|
|
45
|
-
|
45
|
+
describe "parameters" do
|
46
46
|
it_should_accept "id", ["--id=1"]
|
47
47
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
48
48
|
end
|
@@ -50,11 +50,11 @@ describe HammerCLIForeman::ConfigReport do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
|
53
|
-
|
53
|
+
describe "DeleteCommand" do
|
54
54
|
|
55
55
|
let(:cmd) { HammerCLIForeman::ConfigReport::DeleteCommand.new("", ctx) }
|
56
56
|
|
57
|
-
|
57
|
+
describe "parameters" do
|
58
58
|
it_should_accept "id", ["--id=1"]
|
59
59
|
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
60
60
|
end
|
data/test/unit/domain_test.rb
CHANGED
@@ -7,19 +7,19 @@ describe HammerCLIForeman::Domain do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:domains, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::Domain::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,17 +29,17 @@ describe HammerCLIForeman::Domain do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
|
32
|
-
|
32
|
+
describe "InfoCommand" do
|
33
33
|
|
34
34
|
let(:cmd) { HammerCLIForeman::Domain::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=arch"]
|
39
39
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
describe "output" do
|
43
43
|
with_params ["--id=1"] do
|
44
44
|
it_should_print_n_records 1
|
45
45
|
it_should_print_columns ["Id", "Name", "Created at", "Updated at"]
|
@@ -50,11 +50,11 @@ describe HammerCLIForeman::Domain do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
|
53
|
-
|
53
|
+
describe "CreateCommand" do
|
54
54
|
|
55
55
|
let(:cmd) { HammerCLIForeman::Domain::CreateCommand.new("", ctx) }
|
56
56
|
|
57
|
-
|
57
|
+
describe "parameters" do
|
58
58
|
it_should_accept "name, fullname", ["--name=domain", "--description=full_domain_name"]
|
59
59
|
# it_should_fail_with "name missing", ["--full-name=full_domain_name"]
|
60
60
|
# TODO: temporarily disabled, parameters are checked in the api
|
@@ -63,11 +63,11 @@ describe HammerCLIForeman::Domain do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
|
66
|
-
|
66
|
+
describe "DeleteCommand" do
|
67
67
|
|
68
68
|
let(:cmd) { HammerCLIForeman::Domain::DeleteCommand.new("", ctx) }
|
69
69
|
|
70
|
-
|
70
|
+
describe "parameters" do
|
71
71
|
it_should_accept "name", ["--name=domain"]
|
72
72
|
it_should_accept "id", ["--id=1"]
|
73
73
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
@@ -76,11 +76,11 @@ describe HammerCLIForeman::Domain do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
|
79
|
-
|
79
|
+
describe "UpdateCommand" do
|
80
80
|
|
81
81
|
let(:cmd) { HammerCLIForeman::Domain::UpdateCommand.new("", ctx) }
|
82
82
|
|
83
|
-
|
83
|
+
describe "parameters" do
|
84
84
|
it_should_accept "name", ["--name=domain", "--new-name=domain2", "--description=full_domain_name"]
|
85
85
|
it_should_accept "id", ["--id=1", "--new-name=domain2", "--description=full_domain_name"]
|
86
86
|
# it_should_fail_with "no params", []
|
@@ -91,7 +91,7 @@ describe HammerCLIForeman::Domain do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
|
94
|
-
|
94
|
+
describe "SetParameterCommand" do
|
95
95
|
|
96
96
|
before :each do
|
97
97
|
ResourceMocks.parameters_index
|
@@ -99,7 +99,7 @@ describe HammerCLIForeman::Domain do
|
|
99
99
|
|
100
100
|
let(:cmd) { HammerCLIForeman::Domain::SetParameterCommand.new("", ctx) }
|
101
101
|
|
102
|
-
|
102
|
+
describe "parameters" do
|
103
103
|
it_should_accept "name, value and domain name", ["--name=name", "--value=val", "--domain=name"]
|
104
104
|
it_should_accept "name, value and domain id", ["--name=name", "--value=val", "--domain-id=1"]
|
105
105
|
it_should_accept "name, value, parameter type and domain name",
|
@@ -113,11 +113,11 @@ describe HammerCLIForeman::Domain do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
|
116
|
-
|
116
|
+
describe "DeleteParameterCommand" do
|
117
117
|
|
118
118
|
let(:cmd) { HammerCLIForeman::Domain::DeleteParameterCommand.new("", ctx) }
|
119
119
|
|
120
|
-
|
120
|
+
describe "parameters" do
|
121
121
|
it_should_accept "name and domain name", ["--name=param", "--domain=name"]
|
122
122
|
it_should_accept "name and domain id", ["--name=param", "--domain-id=1"]
|
123
123
|
|