hammer_cli_katello 1.3.0 → 1.3.1

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.
@@ -0,0 +1,29 @@
1
+ require_relative '../test_helper.rb'
2
+ require_relative '../organization/organization_helpers'
3
+ require_relative '../content_view/content_view_helpers'
4
+ require_relative '../repository/repository_helpers'
5
+ require_relative '../product/product_helpers'
6
+ require 'hammer_cli_katello/content_units'
7
+
8
+ module HammerCLIKatello
9
+ describe ContentUnitsCommand::InfoCommand do
10
+ include ContentViewHelpers
11
+ include RepositoryHelpers
12
+ include ProductHelpers
13
+ include OrganizationHelpers
14
+
15
+ it 'allows minimal options' do
16
+ api_expects(:generic_content_units, :show)
17
+ .with_params('content_type' => 'python_package', 'id' => '1492')
18
+
19
+ run_cmd(%w(content-units info --content-type python_package --id 1492))
20
+ end
21
+
22
+ it 'requires content_type param' do
23
+ api_expects_no_call
24
+
25
+ r = run_cmd(%w(content-units info --id 1492))
26
+ assert(r.err.include?("Missing arguments for '--content-type'"), "Invalid error message")
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,106 @@
1
+ require_relative '../test_helper.rb'
2
+ require_relative '../organization/organization_helpers'
3
+ require_relative '../content_view/content_view_helpers'
4
+ require_relative '../repository/repository_helpers'
5
+ require_relative '../product/product_helpers'
6
+ require 'hammer_cli_katello/content_units'
7
+
8
+ module HammerCLIKatello
9
+ describe ContentUnitsCommand::ListCommand do
10
+ include ContentViewHelpers
11
+ include RepositoryHelpers
12
+ include ProductHelpers
13
+ include OrganizationHelpers
14
+
15
+ it 'allows minimal options' do
16
+ api_expects(:generic_content_units, :index)
17
+ .with_params('content_type' => 'python_package')
18
+
19
+ run_cmd(%w(content-units list --content-type python_package))
20
+ end
21
+
22
+ it 'requires content_type param' do
23
+ api_expects_no_call
24
+
25
+ r = run_cmd(%w(content-units list))
26
+ assert(r.err.include?("Missing arguments for '--content-type'"), "Invalid error message")
27
+ end
28
+
29
+ describe 'repository options' do
30
+ it 'may be specified by ID' do
31
+ api_expects(:generic_content_units, :index)
32
+ .with_params('content_type' => 'python_package', 'repository_id' => 1)
33
+
34
+ run_cmd(%w(content-units list --content-type python_package --repository-id 1))
35
+ end
36
+
37
+ it 'require product ID when given repository name' do
38
+ api_expects_no_call
39
+
40
+ r = run_cmd(%w(content-units list --content-type python_package --repository repo1))
41
+ assert(r.err.include?("--product, --product-id is required"), "Invalid error message")
42
+ end
43
+
44
+ # rubocop:disable LineLength
45
+ it 'may be specified by name and product ID' do
46
+ expect_repository_search(2, 'repo1', 1)
47
+
48
+ api_expects(:generic_content_units, :index)
49
+ .with_params('content_type' => 'python_package', 'repository_id' => 1)
50
+ run_cmd(%w(content-units list --content-type python_package --repository repo1 --product-id 2))
51
+ end
52
+ # rubocop:enable LineLength
53
+ end
54
+
55
+ describe 'organization options' do
56
+ it 'may be specified by ID' do
57
+ api_expects(:generic_content_units, :index)
58
+ .with_params('organization_id' => 1, 'content_type' => 'python_package')
59
+
60
+ run_cmd(%w(content-units list --organization-id 1 --content-type python_package))
61
+ end
62
+
63
+ it 'may be specified by name' do
64
+ expect_organization_search('org3', 1)
65
+ api_expects(:generic_content_units, :index)
66
+ .with_params('organization_id' => 1, 'content_type' => 'python_package')
67
+
68
+ run_cmd(%w(content-units list --organization org3 --content-type python_package))
69
+ end
70
+
71
+ it 'may be specified by label' do
72
+ expect_organization_search('org3', 1, field: 'label')
73
+ api_expects(:generic_content_units, :index)
74
+ .with_params('organization_id' => 1, 'content_type' => 'python_package')
75
+
76
+ run_cmd(%w(content-units list --organization-label org3 --content-type python_package))
77
+ end
78
+ end
79
+
80
+ describe 'content-view options' do
81
+ # rubocop:disable LineLength
82
+ it 'may be specified by ID' do
83
+ api_expects(:content_view_versions, :index)
84
+ .with_params('content_view_id' => 1, 'version' => '2.1')
85
+ .returns(index_response([{'id' => 5}]))
86
+ api_expects(:generic_content_units, :index)
87
+ .with_params('content_view_version_id' => 5, 'content_type' => 'python_package')
88
+
89
+ run_cmd(
90
+ %w(
91
+ content-units list --content-view-id 1 --content-view-version 2.1 --content-type python_package
92
+ )
93
+ )
94
+ end
95
+
96
+ it 'requires organization ID when given content view name' do
97
+ api_expects_no_call
98
+
99
+ r = run_cmd(%w(content-units list --content-view cv1 --content-view-version 2.1 --content-type python_package))
100
+ expected_error = "--organization-id, --organization, --organization-label is required"
101
+ assert(r.err.include?(expected_error), "Invalid error message")
102
+ end
103
+ # rubocop:enable LineLength
104
+ end
105
+ end
106
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_katello
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Price
@@ -35,7 +35,7 @@ authors:
35
35
  autorequire:
36
36
  bindir: bin
37
37
  cert_chain: []
38
- date: 2021-11-11 00:00:00.000000000 Z
38
+ date: 2021-11-29 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: hammer_cli_foreman
@@ -220,6 +220,7 @@ files:
220
220
  - lib/hammer_cli_katello/content_export_incremental.rb
221
221
  - lib/hammer_cli_katello/content_import.rb
222
222
  - lib/hammer_cli_katello/content_override.rb
223
+ - lib/hammer_cli_katello/content_units.rb
223
224
  - lib/hammer_cli_katello/content_view.rb
224
225
  - lib/hammer_cli_katello/content_view_component.rb
225
226
  - lib/hammer_cli_katello/content_view_name_resolvable.rb
@@ -262,7 +263,6 @@ files:
262
263
  - lib/hammer_cli_katello/option_sources/lifecycle_environment_params.rb
263
264
  - lib/hammer_cli_katello/organization.rb
264
265
  - lib/hammer_cli_katello/organization_options.rb
265
- - lib/hammer_cli_katello/ostree_branch.rb
266
266
  - lib/hammer_cli_katello/output/fields.rb
267
267
  - lib/hammer_cli_katello/output/formatters.rb
268
268
  - lib/hammer_cli_katello/package.rb
@@ -358,6 +358,8 @@ files:
358
358
  - test/functional/content_import/list_test.rb
359
359
  - test/functional/content_import/metadata.json
360
360
  - test/functional/content_import/version_test.rb
361
+ - test/functional/content_units/info_test.rb
362
+ - test/functional/content_units/list_test.rb
361
363
  - test/functional/content_view/add_content_view_version_test.rb
362
364
  - test/functional/content_view/add_repository_test.rb
363
365
  - test/functional/content_view/component/add_test.rb
@@ -575,6 +577,8 @@ test_files:
575
577
  - test/functional/content_import/list_test.rb
576
578
  - test/functional/content_import/metadata.json
577
579
  - test/functional/content_import/version_test.rb
580
+ - test/functional/content_units/info_test.rb
581
+ - test/functional/content_units/list_test.rb
578
582
  - test/functional/content_view/add_content_view_version_test.rb
579
583
  - test/functional/content_view/add_repository_test.rb
580
584
  - test/functional/content_view/component/add_test.rb
@@ -1,34 +0,0 @@
1
- module HammerCLIKatello
2
- class OstreeBranchCommand < HammerCLIKatello::Command
3
- resource :ostree_branches
4
-
5
- class ListCommand < HammerCLIKatello::ListCommand
6
- extend RepositoryScopedToProduct
7
-
8
- validate_repo_name_requires_product_options(:option_repository_name)
9
-
10
- output do
11
- field :id, _("Id")
12
- field :name, _("Name")
13
- field :version, _("version")
14
- end
15
-
16
- build_options do |o|
17
- o.expand.including(:products, :organizations, :content_views)
18
- end
19
- end
20
-
21
- class InfoCommand < HammerCLIKatello::InfoCommand
22
- output do
23
- field :id, _("Id")
24
- field :name, _("Name")
25
- field :version, _("Version")
26
- field :commit, _("Commit")
27
- end
28
-
29
- build_options
30
- end
31
-
32
- autoload_subcommands
33
- end
34
- end