hammer_cli_foreman 2.3.1 → 2.4.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/release_notes.md +7 -1
- 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/status.rb +1 -1
- data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
- data/lib/hammer_cli_foreman/config_group.rb +5 -5
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +1 -1
- 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/settings.rb +3 -3
- data/lib/hammer_cli_foreman/usergroup.rb +5 -5
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/test/functional/architecture_test.rb +49 -0
- data/test/functional/bookmark_test.rb +20 -0
- data/test/functional/compute_profile_test.rb +43 -0
- data/test/functional/config_group_test.rb +50 -0
- data/test/functional/filter_test.rb +114 -47
- data/test/functional/host_test.rb +63 -2
- data/test/functional/mail_notification_test.rb +20 -0
- data/test/functional/model_test.rb +50 -0
- data/test/functional/operating_system_test.rb +51 -0
- data/test/functional/settings_test.rb +21 -0
- data/test/functional/status_test.rb +79 -13
- data/test/functional/usergroup_test.rb +51 -0
- 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/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 +20 -4
@@ -24,6 +24,26 @@ describe 'mail_notification' do
|
|
24
24
|
result = run_cmd(@cmd)
|
25
25
|
assert_cmd(expected_result, result)
|
26
26
|
end
|
27
|
+
|
28
|
+
it 'should run list command with defaults' do
|
29
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.1')) }
|
30
|
+
defaults = HammerCLI::Defaults.new(
|
31
|
+
{
|
32
|
+
organization_id: {
|
33
|
+
provider: 'foreman'
|
34
|
+
},
|
35
|
+
location_id: {
|
36
|
+
provider: 'foreman'
|
37
|
+
}
|
38
|
+
}
|
39
|
+
)
|
40
|
+
defaults.stubs(:write_to_file).returns(true)
|
41
|
+
defaults.stubs(:providers).returns(providers)
|
42
|
+
api_expects(:mail_notifications, :index, 'List mail notifications').returns(@mail_notifications)
|
43
|
+
|
44
|
+
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
45
|
+
_(result.exit_code).must_equal HammerCLI::EX_OK
|
46
|
+
end
|
27
47
|
end
|
28
48
|
|
29
49
|
describe 'info' do
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
4
|
+
|
5
|
+
describe 'model' do
|
6
|
+
describe 'list' do
|
7
|
+
before do
|
8
|
+
@cmd = %w[model list]
|
9
|
+
@models = [{
|
10
|
+
id: 1,
|
11
|
+
name: 'model',
|
12
|
+
}]
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return a list of models' do
|
16
|
+
api_expects(:models, :index, 'List models').returns(@models)
|
17
|
+
|
18
|
+
output = IndexMatcher.new([
|
19
|
+
%w[ID NAME],
|
20
|
+
%w[1 model]
|
21
|
+
])
|
22
|
+
expected_result = success_result(output)
|
23
|
+
|
24
|
+
result = run_cmd(@cmd)
|
25
|
+
assert_cmd(expected_result, result)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should run list command with defaults' do
|
29
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.1')) }
|
30
|
+
defaults = HammerCLI::Defaults.new(
|
31
|
+
{
|
32
|
+
organization_id: {
|
33
|
+
provider: 'foreman'
|
34
|
+
},
|
35
|
+
location_id: {
|
36
|
+
provider: 'foreman'
|
37
|
+
}
|
38
|
+
}
|
39
|
+
)
|
40
|
+
defaults.stubs(:write_to_file).returns(true)
|
41
|
+
defaults.stubs(:providers).returns(providers)
|
42
|
+
api_expects(:models, :index, 'List models').returns(@models)
|
43
|
+
|
44
|
+
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
45
|
+
_(result.exit_code).must_equal HammerCLI::EX_OK
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
4
|
+
|
5
|
+
describe 'operating_system' do
|
6
|
+
describe 'list' do
|
7
|
+
before do
|
8
|
+
@cmd = %w[os list]
|
9
|
+
@operating_system = [{
|
10
|
+
id: 1,
|
11
|
+
release_name: 'Redhat 7',
|
12
|
+
family: 'Redhat',
|
13
|
+
}]
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should return a list of operating system' do
|
17
|
+
api_expects(:operatingsystems, :index, 'List operating systems').returns(@operating_system)
|
18
|
+
|
19
|
+
output = IndexMatcher.new([
|
20
|
+
['ID', 'RELEASE NAME', 'FAMILY'],
|
21
|
+
['1', 'Redhat 7', 'Redhat']
|
22
|
+
])
|
23
|
+
expected_result = success_result(output)
|
24
|
+
|
25
|
+
result = run_cmd(@cmd)
|
26
|
+
assert_cmd(expected_result, result)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should run list command with defaults' do
|
30
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.1')) }
|
31
|
+
defaults = HammerCLI::Defaults.new(
|
32
|
+
{
|
33
|
+
organization_id: {
|
34
|
+
provider: 'foreman'
|
35
|
+
},
|
36
|
+
location_id: {
|
37
|
+
provider: 'foreman'
|
38
|
+
}
|
39
|
+
}
|
40
|
+
)
|
41
|
+
defaults.stubs(:write_to_file).returns(true)
|
42
|
+
defaults.stubs(:providers).returns(providers)
|
43
|
+
api_expects(:operatingsystems, :index, 'List operating systems').returns(@operating_system)
|
44
|
+
|
45
|
+
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
46
|
+
_(result.exit_code).must_equal HammerCLI::EX_OK
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
@@ -31,6 +31,27 @@ describe 'Settings' do
|
|
31
31
|
assert_cmd(expected_result, result)
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'should run list command with defaults' do
|
35
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.1')) }
|
36
|
+
defaults = HammerCLI::Defaults.new(
|
37
|
+
{
|
38
|
+
organization_id: {
|
39
|
+
provider: 'foreman'
|
40
|
+
},
|
41
|
+
location_id: {
|
42
|
+
provider: 'foreman'
|
43
|
+
}
|
44
|
+
}
|
45
|
+
)
|
46
|
+
defaults.stubs(:write_to_file).returns(true)
|
47
|
+
defaults.stubs(:providers).returns(providers)
|
48
|
+
api_expects(:settings, :index, 'List').with_params(
|
49
|
+
'page' => 1, 'per_page' => 1000
|
50
|
+
).returns(index_response([setting]))
|
51
|
+
|
52
|
+
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
53
|
+
_(result.exit_code).must_equal HammerCLI::EX_OK
|
54
|
+
end
|
34
55
|
end
|
35
56
|
|
36
57
|
describe 'info' do
|
@@ -1,24 +1,60 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
2
|
|
3
|
+
BASIC_STATUS = {
|
4
|
+
'database' => { 'active' => true, 'duration_ms' => 0 },
|
5
|
+
'version' => '1.24.0-develop',
|
6
|
+
'api' => { 'version' => 'v2' },
|
7
|
+
'plugins' => [],
|
8
|
+
'smart_proxies' => [],
|
9
|
+
'compute_resources' => []
|
10
|
+
}
|
11
|
+
|
12
|
+
STRING_STATUS = Marshal.load(Marshal.dump(BASIC_STATUS)).merge({
|
13
|
+
'plugins' => [
|
14
|
+
'Foreman plugin: foreman_ansible, 6.0.1, Daniel Lobato Garcia, Ansible integration with Foreman'
|
15
|
+
]
|
16
|
+
})
|
17
|
+
|
18
|
+
STRUCTURED_STATUS = Marshal.load(Marshal.dump(BASIC_STATUS)).merge({
|
19
|
+
'plugins' => [
|
20
|
+
{'name': 'foreman_ansible', 'version': '6.0.1'}
|
21
|
+
]
|
22
|
+
})
|
23
|
+
|
3
24
|
describe 'status' do
|
4
25
|
let(:base_cmd) { %w[status] }
|
5
26
|
|
6
27
|
describe 'foreman' do
|
7
28
|
let(:cmd) { base_cmd << 'foreman' }
|
8
|
-
let(:status_results)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
29
|
+
let(:status_results) { {'results' => {'foreman' => BASIC_STATUS }} }
|
30
|
+
|
31
|
+
it 'checks status of the foreman system' do
|
32
|
+
api_expects(:ping, :statuses, 'Status').returns(status_results)
|
33
|
+
|
34
|
+
output = OutputMatcher.new(
|
35
|
+
[
|
36
|
+
'Version: 1.24.0-develop',
|
37
|
+
'API Version: v2',
|
38
|
+
'Database:',
|
39
|
+
' Status: ok',
|
40
|
+
' Server Response: Duration: 0ms',
|
41
|
+
'Plugins:',
|
42
|
+
'',
|
43
|
+
'Smart Proxies:',
|
44
|
+
'',
|
45
|
+
'Compute Resources:'
|
46
|
+
]
|
47
|
+
)
|
48
|
+
|
49
|
+
expected_result = success_result(output)
|
50
|
+
result = run_cmd(cmd)
|
51
|
+
assert_cmd(expected_result, result)
|
21
52
|
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe 'foreman with string plugins' do
|
56
|
+
let(:cmd) { base_cmd << 'foreman' }
|
57
|
+
let(:status_results) { {'results' => {'foreman' => STRING_STATUS }} }
|
22
58
|
|
23
59
|
it 'checks status of the foreman system' do
|
24
60
|
api_expects(:ping, :statuses, 'Status').returns(status_results)
|
@@ -31,7 +67,37 @@ describe 'status' do
|
|
31
67
|
' Status: ok',
|
32
68
|
' Server Response: Duration: 0ms',
|
33
69
|
'Plugins:',
|
70
|
+
' 1) Name: foreman_ansible',
|
71
|
+
' Version: 6.0.1',
|
72
|
+
'Smart Proxies:',
|
34
73
|
'',
|
74
|
+
'Compute Resources:'
|
75
|
+
]
|
76
|
+
)
|
77
|
+
|
78
|
+
expected_result = success_result(output)
|
79
|
+
result = run_cmd(cmd)
|
80
|
+
assert_cmd(expected_result, result)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'foreman with structured plugins' do
|
85
|
+
let(:cmd) { base_cmd << 'foreman' }
|
86
|
+
let(:status_results) { {'results' => {'foreman' => STRUCTURED_STATUS }} }
|
87
|
+
|
88
|
+
it 'checks status of the foreman system' do
|
89
|
+
api_expects(:ping, :statuses, 'Status').returns(status_results)
|
90
|
+
|
91
|
+
output = OutputMatcher.new(
|
92
|
+
[
|
93
|
+
'Version: 1.24.0-develop',
|
94
|
+
'API Version: v2',
|
95
|
+
'Database:',
|
96
|
+
' Status: ok',
|
97
|
+
' Server Response: Duration: 0ms',
|
98
|
+
'Plugins:',
|
99
|
+
' 1) Name: foreman_ansible',
|
100
|
+
' Version: 6.0.1',
|
35
101
|
'Smart Proxies:',
|
36
102
|
'',
|
37
103
|
'Compute Resources:'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
4
|
+
|
5
|
+
describe 'user-group' do
|
6
|
+
describe 'list' do
|
7
|
+
before do
|
8
|
+
@cmd = %w[user-group list]
|
9
|
+
@user_groups = [{
|
10
|
+
id: 1,
|
11
|
+
name: 'test-user-group',
|
12
|
+
admin: 'yes',
|
13
|
+
}]
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should return a list of user groups' do
|
17
|
+
api_expects(:usergroups, :index, 'List user groups').returns(@user_groups)
|
18
|
+
|
19
|
+
output = IndexMatcher.new([
|
20
|
+
%w[ID NAME ADMIN],
|
21
|
+
%w[1 test-user-group yes]
|
22
|
+
])
|
23
|
+
expected_result = success_result(output)
|
24
|
+
|
25
|
+
result = run_cmd(@cmd)
|
26
|
+
assert_cmd(expected_result, result)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should run list command with defaults' do
|
30
|
+
providers = { 'foreman' => HammerCLIForeman::Defaults.new(api_connection({}, '2.1')) }
|
31
|
+
defaults = HammerCLI::Defaults.new(
|
32
|
+
{
|
33
|
+
organization_id: {
|
34
|
+
provider: 'foreman'
|
35
|
+
},
|
36
|
+
location_id: {
|
37
|
+
provider: 'foreman'
|
38
|
+
}
|
39
|
+
}
|
40
|
+
)
|
41
|
+
defaults.stubs(:write_to_file).returns(true)
|
42
|
+
defaults.stubs(:providers).returns(providers)
|
43
|
+
api_expects(:usergroups, :index, 'List user groups').returns(@user_groups)
|
44
|
+
|
45
|
+
result = run_cmd(@cmd, { use_defaults: true, defaults: defaults })
|
46
|
+
_(result.exit_code).must_equal HammerCLI::EX_OK
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
@@ -237,6 +237,27 @@ module ResourceMocks
|
|
237
237
|
)
|
238
238
|
end
|
239
239
|
|
240
|
+
def self.bookmarks
|
241
|
+
ResourceMocks.mock_action_calls(
|
242
|
+
[:bookmarks, :index, []],
|
243
|
+
[:bookmarks, :show, {}]
|
244
|
+
)
|
245
|
+
end
|
246
|
+
|
247
|
+
def self.mail_notifications
|
248
|
+
ResourceMocks.mock_action_calls(
|
249
|
+
[:mail_notifications, :index, []],
|
250
|
+
[:mail_notifications, :show, {}]
|
251
|
+
)
|
252
|
+
end
|
253
|
+
|
254
|
+
def self.compute_profiles
|
255
|
+
ResourceMocks.mock_action_calls(
|
256
|
+
[:compute_profiles, :index, []],
|
257
|
+
[:compute_profiles, :show, {}]
|
258
|
+
)
|
259
|
+
end
|
260
|
+
|
240
261
|
def self.parameters_index
|
241
262
|
ResourceMocks.mock_action_call(:parameters, :index, [])
|
242
263
|
end
|
@@ -17,6 +17,8 @@ describe HammerCLIForeman::Architecture 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
|
@@ -37,6 +39,8 @@ describe HammerCLIForeman::Architecture do
|
|
37
39
|
context "parameters" do
|
38
40
|
it_should_accept "id", ["--id=1"]
|
39
41
|
it_should_accept "name", ["--name=arch"]
|
42
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
43
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
40
44
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
41
45
|
end
|
42
46
|
|
@@ -57,6 +61,8 @@ describe HammerCLIForeman::Architecture do
|
|
57
61
|
|
58
62
|
context "parameters" do
|
59
63
|
it_should_accept "name", ["--name=arch"]
|
64
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
65
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
60
66
|
# it_should_fail_with "name missing", []
|
61
67
|
# TODO: temporarily disabled, parameters are checked in the api
|
62
68
|
end
|
@@ -71,6 +77,8 @@ describe HammerCLIForeman::Architecture do
|
|
71
77
|
context "parameters" do
|
72
78
|
it_should_accept "name", ["--name=arch"]
|
73
79
|
it_should_accept "id", ["--id=1"]
|
80
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
81
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
74
82
|
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
75
83
|
end
|
76
84
|
|
@@ -84,9 +92,10 @@ describe HammerCLIForeman::Architecture do
|
|
84
92
|
context "parameters" do
|
85
93
|
it_should_accept "name", ["--name=arch", "--new-name=arch2"]
|
86
94
|
it_should_accept "id", ["--id=1", "--new-name=arch2"]
|
95
|
+
it_should_fail_with 'organization param', ['--organization-id=1']
|
96
|
+
it_should_fail_with 'location param', ['--location-id=1']
|
87
97
|
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
88
98
|
# it_should_fail_with "name or id missing", ["--new-name=arch2"] # TODO: temporarily disabled, parameters are checked in the id resolver
|
89
99
|
end
|
90
|
-
|
91
100
|
end
|
92
101
|
end
|
@@ -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
|