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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85d5c798f08f0d775ede7457aab35f687b300a74d623cb07cfd43a532a9af6ac
|
4
|
+
data.tar.gz: b2c32e64f0fa54187da3e66fe745ef7da093f9696e7757737a2dd802c7ffcd5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3575fcc16dd4f4a48549b121b6ef4cbde40cfcd9a8de8f7b8f7fa395d843926962b61f0b543f50a0b58aac7235df9e5682b1a0b21ee1a5e870c6d13df706343
|
7
|
+
data.tar.gz: 8ebbec2ded6ed488d41de567e2696d564ed0640eb7c1c9305f77c318218dff5b8456808cd0e9bc3a441fbebf7b4e0388a16c06297147fe3c6a0ee9e5e427d311
|
data/doc/host_create.md
CHANGED
@@ -252,12 +252,6 @@ preallocate # boolean, set true to preallocate
|
|
252
252
|
wipe_after_delete # boolean, set true to wipe disk after delete
|
253
253
|
```
|
254
254
|
|
255
|
-
## Rackspace
|
256
|
-
Available keys for `--compute-attributes`:
|
257
|
-
```
|
258
|
-
flavor_id
|
259
|
-
```
|
260
|
-
|
261
255
|
## VMware
|
262
256
|
Available keys for `--compute-attributes`:
|
263
257
|
```
|
data/doc/release_notes.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
+
### 3.9.0 (2023-11-29)
|
4
|
+
* Add cache status to ping output ([PR #622](https://github.com/theforeman/hammer-cli-foreman/pull/622)), [#36954](http://projects.theforeman.org/issues/36954)
|
5
|
+
* Use strings, not floats to denote ruby versions ([PR #623](https://github.com/theforeman/hammer-cli-foreman/pull/623))
|
6
|
+
* Update packit
|
7
|
+
* Drop rackspace cr support ([PR #619](https://github.com/theforeman/hammer-cli-foreman/pull/619)), [#36813](http://projects.theforeman.org/issues/36813)
|
8
|
+
* Update rel-eng
|
9
|
+
* Bump to 3.9.0-develop
|
10
|
+
|
11
|
+
### 3.8.0 (2023-08-25)
|
12
|
+
* Support mocha 2.1 ([PR #618](https://github.com/theforeman/hammer-cli-foreman/pull/618)), [#34879](http://projects.theforeman.org/issues/34879)
|
13
|
+
* Add ga to run tests on ruby 3+ ([PR #617](https://github.com/theforeman/hammer-cli-foreman/pull/617))
|
14
|
+
* Update tx for hammer-cli-foreman, [#36315](http://projects.theforeman.org/issues/36315)
|
15
|
+
* Add packit config
|
16
|
+
* Bump to 3.8.0-develop
|
17
|
+
|
3
18
|
### 3.7.0 (2023-05-23)
|
4
19
|
* Update rake for hammer-cli-foreman ([PR #613](https://github.com/theforeman/hammer-cli-foreman/pull/613)), [#36337](http://projects.theforeman.org/issues/36337)
|
5
20
|
* Update minitest version ([PR #611](https://github.com/theforeman/hammer-cli-foreman/pull/611)), [#36349](http://projects.theforeman.org/issues/36349)
|
@@ -7,9 +7,23 @@ module HammerCLIForeman
|
|
7
7
|
data['results']['foreman']['database']['active'] = status ? 'ok' : 'FAIL'
|
8
8
|
duration = data['results']['foreman']['database']['duration_ms']
|
9
9
|
data['results']['foreman']['database']['duration_ms'] = _('Duration: %sms') % duration
|
10
|
+
cache = data['results']['foreman']['cache']
|
11
|
+
data['results']['foreman']['cache'] = format_cache(cache) if cache
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
15
|
+
def self.format_cache(cache)
|
16
|
+
servers = cache['servers'].map do |server|
|
17
|
+
{
|
18
|
+
status: server['status'],
|
19
|
+
duration_ms: _('Duration: %sms') % server['duration_ms']
|
20
|
+
}
|
21
|
+
end
|
22
|
+
{
|
23
|
+
'servers': servers
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
13
27
|
def self.check_for_unrecognized(plugins, output_definition)
|
14
28
|
failed = plugins.select { |_, data| data['services'] }
|
15
29
|
.each_with_object([]) { |(_, d), s| s << d['services'] }
|
@@ -13,6 +13,5 @@ module HammerCLIForeman
|
|
13
13
|
require 'hammer_cli_foreman/compute_resource/libvirt.rb'
|
14
14
|
require 'hammer_cli_foreman/compute_resource/openstack.rb'
|
15
15
|
require 'hammer_cli_foreman/compute_resource/ovirt.rb'
|
16
|
-
require 'hammer_cli_foreman/compute_resource/rackspace.rb'
|
17
16
|
require 'hammer_cli_foreman/compute_resource/vmware.rb'
|
18
17
|
end
|
@@ -12,6 +12,12 @@ module HammerCLIForeman
|
|
12
12
|
field :active, _('Status')
|
13
13
|
field :duration_ms, _('Server Response')
|
14
14
|
end
|
15
|
+
field :cache, _('cache'), Fields::Label do
|
16
|
+
field :servers, _('servers'), Fields::Collection do
|
17
|
+
field :status, _('Status')
|
18
|
+
field :duration_ms, _('Server Response')
|
19
|
+
end
|
20
|
+
end
|
15
21
|
end
|
16
22
|
end
|
17
23
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), 'test_helper')
|
|
3
3
|
require 'hammer_cli_foreman/operating_system'
|
4
4
|
|
5
5
|
describe HammerCLIForeman::OperatingSystem do
|
6
|
-
|
6
|
+
describe 'AddProvisioningTemplateCommand' do
|
7
7
|
before do
|
8
8
|
@cmd = ['os', 'add-provisioning-template']
|
9
9
|
@os_before_update = {
|
@@ -106,7 +106,7 @@ describe HammerCLIForeman::OperatingSystem do
|
|
106
106
|
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
describe 'RemoveProvisioningTemplateCommand' do
|
110
110
|
before do
|
111
111
|
@cmd = ['os', 'remove-provisioning-template']
|
112
112
|
@os_before_update = {
|
@@ -33,7 +33,7 @@ describe HammerCLIForeman::ListCommand do
|
|
33
33
|
HammerCLI::Settings.clear
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
describe 'help' do
|
37
37
|
let(:cmd) { ['host', 'list'] }
|
38
38
|
let(:params) { ['--help'] }
|
39
39
|
|
@@ -49,7 +49,7 @@ describe HammerCLIForeman::ListCommand do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "api interaction" do
|
52
|
-
|
52
|
+
describe "without per_page in settings" do
|
53
53
|
it "fetches only first page when there's not enough records" do
|
54
54
|
expect_paged_call(1, 1000, 10)
|
55
55
|
result = run_cmd([], {}, TestList)
|
@@ -86,7 +86,7 @@ describe HammerCLIForeman::ListCommand do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
|
89
|
+
describe "with per_page in settings" do
|
90
90
|
let(:per_page_in_settings) { 30 }
|
91
91
|
before do
|
92
92
|
HammerCLI::Settings.load({ :ui => { :per_page => per_page_in_settings } })
|
@@ -139,7 +139,7 @@ describe HammerCLIForeman::ListCommand do
|
|
139
139
|
assert_cmd(expected_result, result)
|
140
140
|
end
|
141
141
|
|
142
|
-
|
142
|
+
describe 'with per_page in settings' do
|
143
143
|
before do
|
144
144
|
HammerCLI::Settings.load({ :ui => { :per_page => '1' } })
|
145
145
|
end
|
@@ -33,6 +33,31 @@ describe 'ping' do
|
|
33
33
|
assert_cmd(expected_result, result)
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'includes cache status if foreman reports it' do
|
37
|
+
ping_results['results']['foreman']['cache'] = {
|
38
|
+
'servers' => [
|
39
|
+
{
|
40
|
+
'status' => 'ok',
|
41
|
+
'duration_ms' => 5
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
api_expects(:ping, :ping, 'Ping').returns(ping_results)
|
46
|
+
|
47
|
+
output = OutputMatcher.new(
|
48
|
+
[
|
49
|
+
'cache:',
|
50
|
+
' servers:',
|
51
|
+
' 1) Status: ok',
|
52
|
+
' Server Response: Duration: 5ms'
|
53
|
+
]
|
54
|
+
)
|
55
|
+
|
56
|
+
expected_result = success_result(output)
|
57
|
+
result = run_cmd(cmd)
|
58
|
+
assert_cmd(expected_result, result)
|
59
|
+
end
|
60
|
+
|
36
61
|
it 'returns 1 if one of the services failed and shows unrecognized services' do
|
37
62
|
ping_results['results']['new_plugin'] = {
|
38
63
|
'services' => {
|
@@ -114,7 +114,7 @@ describe 'report-template' do
|
|
114
114
|
|
115
115
|
it 'invokes editor in interactive mode' do
|
116
116
|
params = ['--name=test', '--default=yes', "--interactive", '--locked=no', '--snippet=no']
|
117
|
-
HammerCLI.expects(:open_in_editor).with("",
|
117
|
+
HammerCLI.expects(:open_in_editor).with("", content_type: "report_template", suffix: ".erb").returns('Template content')
|
118
118
|
api_expects(:report_templates, :create, 'Create template').with_params(
|
119
119
|
'report_template' => {
|
120
120
|
'name' => 'test',
|
@@ -181,7 +181,7 @@ describe 'report-template' do
|
|
181
181
|
it 'invokes editor in interactive mode' do
|
182
182
|
params = ['--id=3', '--new-name=test', '--default=yes', "--interactive", '--locked=no', '--snippet=no']
|
183
183
|
HammerCLI.expects(:open_in_editor).with(
|
184
|
-
"Template Content",
|
184
|
+
"Template Content", content_type: "report_template", suffix: ".erb").returns('Template content')
|
185
185
|
api_expects(:report_templates, :show, 'Show').with_params('id' => '3').returns(third_report)
|
186
186
|
api_expects(:report_templates, :update, 'Update template').with_params(
|
187
187
|
'report_template' => {
|
@@ -307,7 +307,7 @@ describe 'report-template' do
|
|
307
307
|
{ 'job_id' => job_id, 'data_url' => "/report_data/#{job_id}" }
|
308
308
|
end
|
309
309
|
|
310
|
-
|
310
|
+
describe 'without --wait' do
|
311
311
|
it 'schedule report and prints out data for getting the result' do
|
312
312
|
params = ['--id=3', '--inputs=Host filter=filter']
|
313
313
|
api_expects(:report_templates, :schedule_report, 'Schedule').with_params(
|
@@ -320,7 +320,7 @@ describe 'report-template' do
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
-
|
323
|
+
describe 'with --wait' do
|
324
324
|
it 'generates the report to the file' do
|
325
325
|
params = ['--id=3', '--inputs=Host filter=filter', '--wait', '--path=/tmp']
|
326
326
|
api_expects(:report_templates, :schedule_report, 'Schedule').with_params(
|
@@ -5,7 +5,7 @@ require 'hammer_cli_foreman/compute_resource'
|
|
5
5
|
|
6
6
|
describe HammerCLIForeman::VirtualMachine do
|
7
7
|
|
8
|
-
|
8
|
+
describe "InfoCommand" do
|
9
9
|
before do
|
10
10
|
@cmd = ["compute-resource", "virtual-machine", "info"]
|
11
11
|
@vm = {
|
@@ -43,7 +43,7 @@ describe HammerCLIForeman::VirtualMachine do
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
describe "ListCommand" do
|
47
47
|
before do
|
48
48
|
@cmd = ["compute-resource", "virtual-machines"]
|
49
49
|
@available_virtual_machines = [
|
@@ -68,7 +68,7 @@ describe HammerCLIForeman::VirtualMachine do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
describe "PowerCommand" do
|
72
72
|
before do
|
73
73
|
@cmd = ["compute-resource", "virtual-machine", "power"]
|
74
74
|
end
|
@@ -97,7 +97,7 @@ describe HammerCLIForeman::VirtualMachine do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
|
100
|
+
describe "DeleteCommand" do
|
101
101
|
before do
|
102
102
|
@cmd = ["compute-resource", "virtual-machine", "delete"]
|
103
103
|
end
|
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,7 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
|
|
4
4
|
let(:request) { mock() }
|
5
5
|
let(:args) { {} }
|
6
6
|
|
7
|
-
|
7
|
+
describe "interactive mode" do
|
8
8
|
before :each do
|
9
9
|
HammerCLI.stubs(:interactive?).returns true
|
10
10
|
end
|
@@ -42,7 +42,7 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
describe "non-interactive mode" do
|
46
46
|
it "doesn't ask for credentials when they're not provided" do
|
47
47
|
HammerCLI.stubs(:interactive?).returns false
|
48
48
|
auth = HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, nil)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
2
|
|
3
3
|
describe HammerCLIForeman::Api::Oauth::AuthenticationCodeGrant do
|
4
|
-
let(:request) {
|
4
|
+
let(:request) { {} }
|
5
5
|
let(:args) { {} }
|
6
6
|
let(:params) {{
|
7
7
|
oidc_redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
@@ -33,7 +33,7 @@ describe HammerCLIForeman::Api::Oauth::AuthenticationCodeGrant do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
describe "interactive mode" do
|
37
37
|
before :each do
|
38
38
|
HammerCLI.stubs(:interactive?).returns true
|
39
39
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
2
|
|
3
3
|
describe HammerCLIForeman::Api::Oauth::PasswordGrant do
|
4
|
-
let(:request) {
|
4
|
+
let(:request) { {} }
|
5
5
|
let(:args) { {} }
|
6
6
|
let(:params) {{
|
7
7
|
username: 'user1',
|
@@ -31,7 +31,7 @@ describe HammerCLIForeman::Api::Oauth::PasswordGrant do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
describe "interactive mode" do
|
35
35
|
before :each do
|
36
36
|
HammerCLI.stubs(:interactive?).returns true
|
37
37
|
end
|
@@ -52,7 +52,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe '#authenticate' do
|
55
|
-
|
55
|
+
describe "when there's saved session" do
|
56
56
|
it 'sets session id in cookies for basic auth' do
|
57
57
|
session_params = {
|
58
58
|
session_id: 'SOME_SESSION_ID', auth_type: 'Basic_Auth'
|
@@ -139,7 +139,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
|
142
|
+
describe "when the session file is corrupted" do
|
143
143
|
it 'reports error' do
|
144
144
|
_dir, _out, err = prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
145
145
|
write_session(dir, '{not a valid: json')
|
@@ -152,7 +152,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
|
155
|
+
describe "when no session is saved" do
|
156
156
|
it 'passes to wrapped authenticator' do
|
157
157
|
prepare_session_storage do |auth, dir|
|
158
158
|
wrapped_auth.expects(:authenticate).with(request, args)
|
@@ -164,7 +164,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
describe '#error' do
|
167
|
-
|
167
|
+
describe 'when there is existing session' do
|
168
168
|
it 'sets session id to nil on unauthorized exception' do
|
169
169
|
prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
170
170
|
ex = RestClient::Unauthorized.new
|
@@ -204,7 +204,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
|
207
|
+
describe 'when user has changed' do
|
208
208
|
it 'sets a special error message' do
|
209
209
|
prepare_session_storage :session_id => 'SOME_SESSION_ID' do |auth, dir|
|
210
210
|
auth.force_user_change
|
@@ -227,7 +227,7 @@ describe HammerCLIForeman::Api::SessionAuthenticatorWrapper do
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
-
|
230
|
+
describe 'when there is no existing session' do
|
231
231
|
it 'passes exception to wrapped authenticator on unauthorized exception' do
|
232
232
|
prepare_session_storage do |auth, dir|
|
233
233
|
ex = RestClient::Unauthorized.new
|
@@ -7,21 +7,21 @@ describe HammerCLIForeman::Architecture do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe "ListCommand" do
|
11
11
|
before do
|
12
12
|
ResourceMocks.mock_action_call(:architectures, :index, [])
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::Architecture::ListCommand.new("", ctx) }
|
16
16
|
|
17
|
-
|
17
|
+
describe "parameters" do
|
18
18
|
it_should_accept "no arguments"
|
19
19
|
it_should_accept_search_params
|
20
20
|
it_should_accept 'organization', ['--organization-id=1']
|
21
21
|
it_should_accept 'location', ['--location-id=1']
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
describe "output" do
|
25
25
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
26
26
|
|
27
27
|
it_should_print_n_records
|
@@ -32,11 +32,11 @@ describe HammerCLIForeman::Architecture do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
|
-
|
35
|
+
describe "InfoCommand" do
|
36
36
|
|
37
37
|
let(:cmd) { HammerCLIForeman::Architecture::InfoCommand.new("", ctx) }
|
38
38
|
|
39
|
-
|
39
|
+
describe "parameters" do
|
40
40
|
it_should_accept "id", ["--id=1"]
|
41
41
|
it_should_accept "name", ["--name=arch"]
|
42
42
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -44,7 +44,7 @@ describe HammerCLIForeman::Architecture do
|
|
44
44
|
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
describe "output" do
|
48
48
|
with_params ["--id=1"] do
|
49
49
|
it_should_print_n_records 1
|
50
50
|
it_should_print_column "Name"
|
@@ -55,11 +55,11 @@ describe HammerCLIForeman::Architecture do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
|
58
|
-
|
58
|
+
describe "CreateCommand" do
|
59
59
|
|
60
60
|
let(:cmd) { HammerCLIForeman::Architecture::CreateCommand.new("", ctx) }
|
61
61
|
|
62
|
-
|
62
|
+
describe "parameters" do
|
63
63
|
it_should_accept "name", ["--name=arch"]
|
64
64
|
it_should_accept 'organization', %w[--name=arch --organization-id=1]
|
65
65
|
it_should_accept 'location', %w[--name=arch --location-id=1]
|
@@ -70,11 +70,11 @@ describe HammerCLIForeman::Architecture do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
|
73
|
-
|
73
|
+
describe "DeleteCommand" do
|
74
74
|
|
75
75
|
let(:cmd) { HammerCLIForeman::Architecture::DeleteCommand.new("", ctx) }
|
76
76
|
|
77
|
-
|
77
|
+
describe "parameters" do
|
78
78
|
it_should_accept "name", ["--name=arch"]
|
79
79
|
it_should_accept "id", ["--id=1"]
|
80
80
|
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
@@ -85,11 +85,11 @@ describe HammerCLIForeman::Architecture do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
|
88
|
-
|
88
|
+
describe "UpdateCommand" do
|
89
89
|
|
90
90
|
let(:cmd) { HammerCLIForeman::Architecture::UpdateCommand.new("", ctx) }
|
91
91
|
|
92
|
-
|
92
|
+
describe "parameters" do
|
93
93
|
it_should_accept "name", ["--name=arch", "--new-name=arch2"]
|
94
94
|
it_should_accept "id", ["--id=1", "--new-name=arch2"]
|
95
95
|
it_should_accept 'organization', %w[--id=1 --new-name=arch2 --organization-id=1]
|
data/test/unit/audit_test.rb
CHANGED
@@ -6,19 +6,19 @@ require 'hammer_cli_foreman/audit'
|
|
6
6
|
describe HammerCLIForeman::Audit do
|
7
7
|
include CommandTestHelper
|
8
8
|
|
9
|
-
|
9
|
+
describe "ListCommand" do
|
10
10
|
before do
|
11
11
|
ResourceMocks.mock_action_call(:audits, :index, [])
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:cmd) { HammerCLIForeman::Audit::ListCommand.new("", ctx) }
|
15
15
|
|
16
|
-
|
16
|
+
describe "parameters" do
|
17
17
|
it_should_accept "no arguments"
|
18
18
|
it_should_accept_search_params
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
describe "output" do
|
22
22
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
23
23
|
|
24
24
|
it_should_print_n_records
|
@@ -32,18 +32,18 @@ describe HammerCLIForeman::Audit do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
describe "InfoCommand" do
|
36
36
|
before do
|
37
37
|
cmd.stubs(:extend_data)
|
38
38
|
end
|
39
39
|
|
40
40
|
let(:cmd) { HammerCLIForeman::Audit::InfoCommand.new("", ctx) }
|
41
41
|
|
42
|
-
|
42
|
+
describe "parameters" do
|
43
43
|
it_should_accept "id", ["--id=1"]
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
describe "output" do
|
47
47
|
with_params ["--id=1"] do
|
48
48
|
it_should_print_n_records 1
|
49
49
|
it_should_print_column "Id"
|
@@ -7,20 +7,20 @@ describe HammerCLIForeman::AuthSourceExternal do
|
|
7
7
|
|
8
8
|
include CommandTestHelper
|
9
9
|
|
10
|
-
|
10
|
+
describe 'ListCommand' do
|
11
11
|
before :each do
|
12
12
|
ResourceMocks.auth_source_external_index
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:cmd) { HammerCLIForeman::AuthSourceExternal::ListCommand.new('', ctx) }
|
16
16
|
|
17
|
-
|
17
|
+
describe 'parameters' do
|
18
18
|
it_should_accept 'no arguments'
|
19
19
|
it_should_accept 'per page', ['--per-page=1']
|
20
20
|
it_should_accept 'page', ['--page=2']
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
describe 'output' do
|
24
24
|
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
25
25
|
|
26
26
|
it_should_print_n_records 1
|
@@ -29,10 +29,10 @@ describe HammerCLIForeman::AuthSourceExternal do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
describe 'UpdateCommand' do
|
33
33
|
let(:cmd) { HammerCLIForeman::AuthSourceExternal::UpdateCommand.new('', ctx) }
|
34
34
|
|
35
|
-
|
35
|
+
describe 'parameters' do
|
36
36
|
it_should_accept 'name', ['--name=External', '--new-name=auth-external-1']
|
37
37
|
it_should_accept 'id', ['--id=11', '--new-name=auth-external-2']
|
38
38
|
end
|