hammer_cli_foreman 3.3.0 → 3.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 +6 -0
- data/lib/hammer_cli_foreman/id_resolver.rb +2 -1
- data/lib/hammer_cli_foreman/table_preference.rb +48 -0
- data/lib/hammer_cli_foreman/user.rb +3 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/test/data/3.4/foreman_api.json +1 -0
- data/test/functional/table_preference_test.rb +100 -0
- data/test/test_helper.rb +1 -1
- metadata +7 -2
@@ -0,0 +1,100 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
describe 'table_preference' do
|
4
|
+
let(:base_cmd) { ['user', 'table-preference'] }
|
5
|
+
let(:user) do
|
6
|
+
{
|
7
|
+
:id => 1,
|
8
|
+
:name => 'admin'
|
9
|
+
}
|
10
|
+
end
|
11
|
+
let(:table_preference) do
|
12
|
+
{
|
13
|
+
:id => 1,
|
14
|
+
:user_id => user[:id],
|
15
|
+
:name => 'Table Preference',
|
16
|
+
:columns => ['A', 'B', 'C']
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'list' do
|
21
|
+
let(:cmd) { base_cmd << 'list' }
|
22
|
+
|
23
|
+
it 'lists table preferences for a given user' do
|
24
|
+
params = ['--user-id', user[:id]]
|
25
|
+
api_expects(:table_preferences, :index, params)
|
26
|
+
.returns(index_response([table_preference]))
|
27
|
+
|
28
|
+
expected_result = success_result(/#{table_preference[:name]}/)
|
29
|
+
|
30
|
+
result = run_cmd(cmd + params)
|
31
|
+
assert_cmd(expected_result, result)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'create' do
|
36
|
+
let(:cmd) { base_cmd << 'create' }
|
37
|
+
|
38
|
+
it 'creates a table preference for a given table' do
|
39
|
+
params = ['--user-id', user[:id],
|
40
|
+
'--name', table_preference[:name],
|
41
|
+
'--columns', table_preference[:columns]]
|
42
|
+
api_expects(:table_preferences, :create, params)
|
43
|
+
.returns(table_preference)
|
44
|
+
|
45
|
+
expected_result = success_result("Table preference created.\n")
|
46
|
+
|
47
|
+
result = run_cmd(cmd + params)
|
48
|
+
assert_cmd(expected_result, result)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'update' do
|
53
|
+
let(:cmd) { base_cmd << 'update' }
|
54
|
+
|
55
|
+
it 'updates a table preference for a given table' do
|
56
|
+
params = ['--user-id', user[:id],
|
57
|
+
'--name', table_preference[:name],
|
58
|
+
'--columns', ['A','B','C','D','E']]
|
59
|
+
api_expects(:table_preferences, :update, params)
|
60
|
+
.returns(table_preference)
|
61
|
+
|
62
|
+
expected_result = success_result("Table preference updated.\n")
|
63
|
+
|
64
|
+
result = run_cmd(cmd + params)
|
65
|
+
assert_cmd(expected_result, result)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe 'info' do
|
70
|
+
let(:cmd) { base_cmd << 'info' }
|
71
|
+
|
72
|
+
it 'shows table preference details of a given table' do
|
73
|
+
params = ['--user-id', user[:id],
|
74
|
+
'--name', table_preference[:name]]
|
75
|
+
api_expects(:table_preferences, :show, params)
|
76
|
+
.returns(table_preference)
|
77
|
+
|
78
|
+
expected_result = success_result(/#{table_preference[:name]} | #{table_preference[:columns]}/)
|
79
|
+
|
80
|
+
result = run_cmd(cmd + params)
|
81
|
+
assert_cmd(expected_result, result)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'delete' do
|
86
|
+
let(:cmd) { base_cmd << 'delete' }
|
87
|
+
|
88
|
+
it 'deletes a table preference for a given table' do
|
89
|
+
params = ['--user-id', user[:id],
|
90
|
+
'--name', table_preference[:name]]
|
91
|
+
api_expects(:table_preferences, :destroy, params)
|
92
|
+
.returns({})
|
93
|
+
|
94
|
+
expected_result = success_result("Table preference deleted.\n")
|
95
|
+
|
96
|
+
result = run_cmd(cmd + params)
|
97
|
+
assert_cmd(expected_result, result)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,7 @@ require "mocha/minitest"
|
|
17
17
|
require 'hammer_cli'
|
18
18
|
require 'hammer_cli_foreman/testing/api_expectations'
|
19
19
|
|
20
|
-
FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '3.
|
20
|
+
FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '3.4'
|
21
21
|
unless Dir.entries('test/data').include? FOREMAN_VERSION
|
22
22
|
raise StandardError.new "Version is not correct"
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomáš Strachota
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hammer_cli
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- lib/hammer_cli_foreman/ssh_keys.rb
|
206
206
|
- lib/hammer_cli_foreman/status.rb
|
207
207
|
- lib/hammer_cli_foreman/subnet.rb
|
208
|
+
- lib/hammer_cli_foreman/table_preference.rb
|
208
209
|
- lib/hammer_cli_foreman/task_helper.rb
|
209
210
|
- lib/hammer_cli_foreman/template.rb
|
210
211
|
- lib/hammer_cli_foreman/testing/api_expectations.rb
|
@@ -245,6 +246,7 @@ files:
|
|
245
246
|
- test/data/2.4/foreman_api.json
|
246
247
|
- test/data/2.5/foreman_api.json
|
247
248
|
- test/data/3.1/foreman_api.json
|
249
|
+
- test/data/3.4/foreman_api.json
|
248
250
|
- test/data/README.md
|
249
251
|
- test/functional/architecture_test.rb
|
250
252
|
- test/functional/associating_commands_test.rb
|
@@ -280,6 +282,7 @@ files:
|
|
280
282
|
- test/functional/status_test.rb
|
281
283
|
- test/functional/subnet/create_test.rb
|
282
284
|
- test/functional/subnet/update_test.rb
|
285
|
+
- test/functional/table_preference_test.rb
|
283
286
|
- test/functional/template_test.rb
|
284
287
|
- test/functional/test_helper.rb
|
285
288
|
- test/functional/user_mail_notification_test.rb
|
@@ -385,6 +388,7 @@ test_files:
|
|
385
388
|
- test/data/2.4/foreman_api.json
|
386
389
|
- test/data/2.5/foreman_api.json
|
387
390
|
- test/data/3.1/foreman_api.json
|
391
|
+
- test/data/3.4/foreman_api.json
|
388
392
|
- test/functional/auth_source_test.rb
|
389
393
|
- test/functional/commands/list_test.rb
|
390
394
|
- test/functional/hostgroup/create_test.rb
|
@@ -425,6 +429,7 @@ test_files:
|
|
425
429
|
- test/functional/bookmark_test.rb
|
426
430
|
- test/functional/model_test.rb
|
427
431
|
- test/functional/registration_test.rb
|
432
|
+
- test/functional/table_preference_test.rb
|
428
433
|
- test/unit/api/void_auth_test.rb
|
429
434
|
- test/unit/api/interactive_basic_auth_test.rb
|
430
435
|
- test/unit/api/oauth/oauth_authentication_code_grant_test.rb
|