hammer_cli_katello 0.1.3 → 0.2.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/lib/hammer_cli_katello.rb +1 -0
- data/lib/hammer_cli_katello/content_view.rb +1 -1
- data/lib/hammer_cli_katello/filter.rb +19 -0
- data/lib/hammer_cli_katello/filter_rule.rb +0 -10
- data/lib/hammer_cli_katello/host_extensions.rb +2 -0
- data/lib/hammer_cli_katello/id_name_options_validator.rb +73 -0
- data/lib/hammer_cli_katello/package.rb +2 -0
- data/lib/hammer_cli_katello/repository.rb +17 -5
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/test/functional/content_view/create_test.rb +0 -3
- data/test/functional/content_view/filter/delete_test.rb +93 -0
- data/test/functional/content_view/filter/info_test.rb +92 -0
- data/test/functional/content_view/filter/list_test.rb +98 -0
- data/test/functional/content_view/filter/update_test.rb +93 -0
- data/test/functional/filter_rule/create_test.rb +0 -79
- data/test/functional/host/extensions/data/host.json +4 -2
- data/test/functional/host/extensions/info_test.rb +3 -1
- data/test/functional/lifecycle_environment/create_test.rb +14 -0
- data/test/functional/lifecycle_environment/list_test.rb +38 -0
- data/test/functional/lifecycle_environment/update_test.rb +14 -0
- data/test/functional/organization/organization_helpers.rb +2 -2
- data/test/functional/package/list_test.rb +48 -0
- data/test/functional/repository/delete_test.rb +101 -0
- data/test/functional/repository/upload_test.rb +43 -0
- data/test/unit/id_name_options_validator_test.rb +96 -0
- metadata +26 -13
- data/test/functional/filter_rule/delete_test.rb +0 -104
- data/test/functional/filter_rule/info_test.rb +0 -104
- data/test/functional/filter_rule/list_test.rb +0 -91
- data/test/functional/filter_rule/update_test.rb +0 -104
@@ -1,91 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require 'hammer_cli_katello/filter_rule'
|
3
|
-
|
4
|
-
module HammerCLIKatello
|
5
|
-
describe FilterRule::ListCommand do
|
6
|
-
it 'allows minimal options' do
|
7
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
8
|
-
p['content_view_filter_id'] == 1
|
9
|
-
end
|
10
|
-
run_cmd(%w(content-view filter rule list --content-view-filter-id 1))
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'allows name resolution with content-view-id' do
|
14
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
15
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
16
|
-
end
|
17
|
-
ex.returns(index_response([{'id' => 1}]))
|
18
|
-
|
19
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
20
|
-
p['content_view_filter_id'] == 1
|
21
|
-
end
|
22
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --content-view-id 3))
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'organization' do
|
26
|
-
it 'ID can be specified to resolve content view name' do
|
27
|
-
ex = api_expects(:content_views, :index) do |p|
|
28
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
29
|
-
end
|
30
|
-
ex.returns(index_response([{'id' => 3}]))
|
31
|
-
|
32
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
33
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
34
|
-
end
|
35
|
-
ex.returns(index_response([{'id' => 1}]))
|
36
|
-
|
37
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
38
|
-
p['content_view_filter_id'] == 1
|
39
|
-
end
|
40
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --organization-id 6
|
41
|
-
--content-view cv3))
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'name can be specified to resolve content view name' do
|
45
|
-
ex = api_expects(:organizations, :index) do |p|
|
46
|
-
p[:search] == "name = \"org6\""
|
47
|
-
end
|
48
|
-
ex.returns(index_response([{'id' => 6}]))
|
49
|
-
|
50
|
-
ex = api_expects(:content_views, :index) do |p|
|
51
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
52
|
-
end
|
53
|
-
ex.returns(index_response([{'id' => 3}]))
|
54
|
-
|
55
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
56
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
57
|
-
end
|
58
|
-
ex.returns(index_response([{'id' => 1}]))
|
59
|
-
|
60
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
61
|
-
p['content_view_filter_id'] == 1
|
62
|
-
end
|
63
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --organization org6
|
64
|
-
--content-view cv3))
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'label can be specified to resolve content view name' do
|
68
|
-
ex = api_expects(:organizations, :index) do |p|
|
69
|
-
p[:search] == "label = \"org6\""
|
70
|
-
end
|
71
|
-
ex.returns(index_response([{'id' => 6}]))
|
72
|
-
|
73
|
-
ex = api_expects(:content_views, :index) do |p|
|
74
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
75
|
-
end
|
76
|
-
ex.returns(index_response([{'id' => 3}]))
|
77
|
-
|
78
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
79
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
80
|
-
end
|
81
|
-
ex.returns(index_response([{'id' => 1}]))
|
82
|
-
|
83
|
-
api_expects(:content_view_filter_rules, :index) do |p|
|
84
|
-
p['content_view_filter_id'] == 1
|
85
|
-
end
|
86
|
-
run_cmd(%w(content-view filter rule list --content-view-filter cvf1 --organization-label
|
87
|
-
org6 --content-view cv3))
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
require 'hammer_cli_katello/filter_rule'
|
3
|
-
|
4
|
-
module HammerCLIKatello
|
5
|
-
describe FilterRule::UpdateCommand do
|
6
|
-
it 'allows minimal options' do
|
7
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
8
|
-
p['content_view_filter_id'] == 1 && p['id'] == '9'
|
9
|
-
end
|
10
|
-
run_cmd(%w(content-view filter rule update --content-view-filter-id 1 --id 9))
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'resolves rule ID from rule name and filter ID' do
|
14
|
-
ex = api_expects(:content_view_filter_rules, :index) do |p|
|
15
|
-
p['content_view_filter_id'] == 1 && p['name'] == 'rule9'
|
16
|
-
end
|
17
|
-
ex.returns(index_response([{'id' => 9}]))
|
18
|
-
|
19
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
20
|
-
p['content_view_filter_id'] == 1 && p['id'] == 9
|
21
|
-
end
|
22
|
-
run_cmd(%w(content-view filter rule update --content-view-filter-id 1 --name rule9))
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'allows name resolution of filter with content-view-id' do
|
26
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
27
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
28
|
-
end
|
29
|
-
ex.returns(index_response([{'id' => 1}]))
|
30
|
-
|
31
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
32
|
-
p['content_view_filter_id'] == 1 && p['id'] == '9'
|
33
|
-
end
|
34
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --content-view-id 3
|
35
|
-
--id 9))
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'organization' do
|
39
|
-
it 'ID can be specified to resolve content view name' do
|
40
|
-
ex = api_expects(:content_views, :index) do |p|
|
41
|
-
p['name'] == 'cv3' && p['organization_id'] == '6'
|
42
|
-
end
|
43
|
-
ex.returns(index_response([{'id' => 3}]))
|
44
|
-
|
45
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
46
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
47
|
-
end
|
48
|
-
ex.returns(index_response([{'id' => 1}]))
|
49
|
-
|
50
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
51
|
-
p['content_view_filter_id'] == 1 && p['id'] == '9'
|
52
|
-
end
|
53
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --organization-id 6
|
54
|
-
--content-view cv3 --id 9))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'name can be specified to resolve content view name' do
|
58
|
-
ex = api_expects(:organizations, :index) do |p|
|
59
|
-
p[:search] == "name = \"org6\""
|
60
|
-
end
|
61
|
-
ex.returns(index_response([{'id' => 6}]))
|
62
|
-
|
63
|
-
ex = api_expects(:content_views, :index) do |p|
|
64
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
65
|
-
end
|
66
|
-
ex.returns(index_response([{'id' => 3}]))
|
67
|
-
|
68
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
69
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
70
|
-
end
|
71
|
-
ex.returns(index_response([{'id' => 1}]))
|
72
|
-
|
73
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
74
|
-
p['content_view_filter_id'] == 1 && p['id'] == '9'
|
75
|
-
end
|
76
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --organization org6
|
77
|
-
--content-view cv3 --id 9))
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'label can be specified to resolve content view name' do
|
81
|
-
ex = api_expects(:organizations, :index) do |p|
|
82
|
-
p[:search] == "label = \"org6\""
|
83
|
-
end
|
84
|
-
ex.returns(index_response([{'id' => 6}]))
|
85
|
-
|
86
|
-
ex = api_expects(:content_views, :index) do |p|
|
87
|
-
p['name'] == 'cv3' && p['organization_id'] == 6
|
88
|
-
end
|
89
|
-
ex.returns(index_response([{'id' => 3}]))
|
90
|
-
|
91
|
-
ex = api_expects(:content_view_filters, :index) do |p|
|
92
|
-
p['name'] == 'cvf1' && p['content_view_id'] == 3
|
93
|
-
end
|
94
|
-
ex.returns(index_response([{'id' => 1}]))
|
95
|
-
|
96
|
-
api_expects(:content_view_filter_rules, :update) do |p|
|
97
|
-
p['content_view_filter_id'] == 1 && p['id'] == '9'
|
98
|
-
end
|
99
|
-
run_cmd(%w(content-view filter rule update --content-view-filter cvf1 --organization-label
|
100
|
-
org6 --content-view cv3 --id 9))
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|