hammer_cli_katello 1.12.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hammer_cli_katello/capsule.rb +20 -0
- data/lib/hammer_cli_katello/content_view.rb +16 -1
- data/lib/hammer_cli_katello/content_view_version.rb +13 -0
- data/lib/hammer_cli_katello/erratum.rb +13 -2
- data/lib/hammer_cli_katello/id_resolver.rb +15 -0
- data/lib/hammer_cli_katello/organization.rb +0 -23
- data/lib/hammer_cli_katello/product.rb +17 -0
- data/lib/hammer_cli_katello/repository.rb +40 -2
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/lib/hammer_cli_katello.rb +0 -6
- data/locale/bn/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/bn/hammer-cli-katello.po +85 -69
- data/locale/bn_IN/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/bn_IN/hammer-cli-katello.po +90 -74
- data/locale/bqi/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/bqi/hammer-cli-katello.po +2133 -0
- data/locale/ca/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ca/hammer-cli-katello.po +90 -74
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/cs_CZ/hammer-cli-katello.po +106 -90
- data/locale/de/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/de/hammer-cli-katello.po +189 -155
- data/locale/de_AT/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/de_AT/hammer-cli-katello.po +87 -71
- data/locale/de_DE/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/de_DE/hammer-cli-katello.po +90 -74
- data/locale/el/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/el/hammer-cli-katello.po +96 -80
- data/locale/en/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/en/hammer-cli-katello.po +85 -70
- data/locale/en_GB/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/en_GB/hammer-cli-katello.po +88 -72
- data/locale/en_US/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/en_US/hammer-cli-katello.po +87 -71
- data/locale/es/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/es/hammer-cli-katello.po +176 -150
- data/locale/et_EE/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/et_EE/hammer-cli-katello.po +87 -71
- data/locale/fr/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/fr/hammer-cli-katello.po +235 -204
- data/locale/gl/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/gl/hammer-cli-katello.po +88 -72
- data/locale/gu/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/gu/hammer-cli-katello.po +88 -72
- data/locale/he_IL/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/he_IL/hammer-cli-katello.po +92 -76
- data/locale/hi/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/hi/hammer-cli-katello.po +88 -72
- data/locale/id/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/id/hammer-cli-katello.po +97 -77
- data/locale/it/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/it/hammer-cli-katello.po +102 -86
- data/locale/ja/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ja/hammer-cli-katello.po +179 -139
- data/locale/ka/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ka/hammer-cli-katello.po +357 -287
- data/locale/kn/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/kn/hammer-cli-katello.po +88 -72
- data/locale/ko/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ko/hammer-cli-katello.po +115 -99
- data/locale/ml_IN/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ml_IN/hammer-cli-katello.po +87 -71
- data/locale/mr/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/mr/hammer-cli-katello.po +88 -72
- data/locale/nl_NL/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/nl_NL/hammer-cli-katello.po +92 -77
- data/locale/or/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/or/hammer-cli-katello.po +88 -72
- data/locale/pa/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/pa/hammer-cli-katello.po +90 -74
- data/locale/pl/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/pl/hammer-cli-katello.po +91 -75
- data/locale/pl_PL/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/pl_PL/hammer-cli-katello.po +90 -74
- data/locale/pt/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/pt/hammer-cli-katello.po +87 -71
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/pt_BR/hammer-cli-katello.po +172 -142
- data/locale/ro/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ro/hammer-cli-katello.po +87 -71
- data/locale/ro_RO/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ro_RO/hammer-cli-katello.po +89 -73
- data/locale/ru/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ru/hammer-cli-katello.po +104 -88
- data/locale/sl/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/sl/hammer-cli-katello.po +91 -75
- data/locale/sv_SE/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/sv_SE/hammer-cli-katello.po +90 -74
- data/locale/ta/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ta/hammer-cli-katello.po +85 -69
- data/locale/ta_IN/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/ta_IN/hammer-cli-katello.po +90 -74
- data/locale/te/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/te/hammer-cli-katello.po +88 -72
- data/locale/tr/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/tr/hammer-cli-katello.po +88 -72
- data/locale/vi/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/vi/hammer-cli-katello.po +85 -69
- data/locale/vi_VN/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/vi_VN/hammer-cli-katello.po +87 -71
- data/locale/zh/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/zh/hammer-cli-katello.po +85 -69
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/zh_CN/hammer-cli-katello.po +143 -119
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-katello.mo +0 -0
- data/locale/zh_TW/hammer-cli-katello.po +103 -87
- data/test/functional/acs/create_test.rb +3 -3
- data/test/functional/content_credentials/create_test.rb +2 -2
- data/test/functional/content_export/complete/repository_test.rb +7 -7
- data/test/functional/content_export/incremental/repository_test.rb +6 -6
- data/test/functional/content_import/library_test.rb +5 -3
- data/test/functional/content_import/version_test.rb +5 -3
- data/test/functional/content_view/component/add_test.rb +5 -5
- data/test/functional/content_view/component/remove_test.rb +9 -9
- data/test/functional/content_view/component/update_test.rb +9 -9
- data/test/functional/content_view/create_test.rb +3 -3
- data/test/functional/organization/info_test.rb +0 -14
- data/test/functional/product/{update_proxy.rb → update_proxy_test.rb} +8 -14
- data/test/functional/product/verify_checksum_test.rb +31 -0
- data/test/functional/repository/create_test.rb +3 -3
- data/test/functional/repository/verify_checksum_test.rb +105 -0
- data/test/functional/sync_plan/create_test.rb +9 -9
- data/test/functional/sync_plan/delete_test.rb +3 -3
- data/test/functional/sync_plan/update_test.rb +5 -5
- data/test/test_helper.rb +1 -0
- metadata +24 -135
- data/lib/hammer_cli_katello/simple_content_access.rb +0 -59
- data/test/functional/simple_content_access/disable_test.rb +0 -48
- data/test/functional/simple_content_access/enable_test.rb +0 -46
- data/test/functional/simple_content_access/status_test.rb +0 -29
@@ -21,7 +21,7 @@ describe 'content-import version' do
|
|
21
21
|
File.dirname(__FILE__)
|
22
22
|
end
|
23
23
|
|
24
|
-
let(:
|
24
|
+
let(:metadata_json) do
|
25
25
|
JSON.parse(File.read("#{path}/metadata.json"))
|
26
26
|
end
|
27
27
|
|
@@ -34,7 +34,8 @@ describe 'content-import version' do
|
|
34
34
|
'--async'
|
35
35
|
]
|
36
36
|
api_expects(:content_imports, :version)
|
37
|
-
.with_params('organization_id' => organization_id, 'path' => path,
|
37
|
+
.with_params('organization_id' => organization_id, 'path' => path,
|
38
|
+
'metadata' => metadata_json)
|
38
39
|
.returns(response)
|
39
40
|
|
40
41
|
result = run_cmd(@cmd + params)
|
@@ -50,7 +51,8 @@ describe 'content-import version' do
|
|
50
51
|
]
|
51
52
|
|
52
53
|
api_expects(:content_imports, :version)
|
53
|
-
.with_params('organization_id' => organization_id, 'path' => path,
|
54
|
+
.with_params('organization_id' => organization_id, 'path' => path,
|
55
|
+
'metadata' => metadata_json)
|
54
56
|
.returns(response)
|
55
57
|
|
56
58
|
expect_foreman_task(task_id)
|
@@ -5,11 +5,11 @@ module HammerCLIKatello
|
|
5
5
|
describe ContentViewComponent::AddComponents do
|
6
6
|
before do
|
7
7
|
@cmd = %w(content-view component add)
|
8
|
-
@composite = OpenStruct.new(:id => 2, :name => "composite")
|
9
|
-
@component_version = OpenStruct.new(:id => 666, :version => "1.0")
|
10
|
-
@component = OpenStruct.new(:id => 6, :name => "component",
|
11
|
-
|
12
|
-
@organization = OpenStruct.new(:id => 1, :name => "great", :label => "label")
|
8
|
+
@composite = ::OpenStruct.new(:id => 2, :name => "composite")
|
9
|
+
@component_version = ::OpenStruct.new(:id => 666, :version => "1.0")
|
10
|
+
@component = ::OpenStruct.new(:id => 6, :name => "component",
|
11
|
+
:content_view_version => @component_version)
|
12
|
+
@organization = ::OpenStruct.new(:id => 1, :name => "great", :label => "label")
|
13
13
|
end
|
14
14
|
|
15
15
|
def setup_org_expectations
|
@@ -5,18 +5,18 @@ module HammerCLIKatello
|
|
5
5
|
before do
|
6
6
|
@cmd = %w(content-view component remove)
|
7
7
|
|
8
|
-
@component = OpenStruct.new(:id => 6, :name => "component")
|
9
|
-
@component2 = OpenStruct.new(:id => 7, :name => "component2")
|
8
|
+
@component = ::OpenStruct.new(:id => 6, :name => "component")
|
9
|
+
@component2 = ::OpenStruct.new(:id => 7, :name => "component2")
|
10
10
|
|
11
|
-
@content_view_component = OpenStruct.new(:id => 1444,
|
12
|
-
|
11
|
+
@content_view_component = ::OpenStruct.new(:id => 1444,
|
12
|
+
:content_view => @component)
|
13
13
|
|
14
|
-
@content_view_component2 = OpenStruct.new(:id => 1445,
|
15
|
-
|
14
|
+
@content_view_component2 = ::OpenStruct.new(:id => 1445,
|
15
|
+
:content_view => @component2)
|
16
16
|
|
17
|
-
@composite = OpenStruct.new(:id => 2, :name => "composite",
|
18
|
-
|
19
|
-
@organization = OpenStruct.new(:id => 1, :name => "great", :label => "label")
|
17
|
+
@composite = ::OpenStruct.new(:id => 2, :name => "composite",
|
18
|
+
:content_view_components => [@content_view_component])
|
19
|
+
@organization = ::OpenStruct.new(:id => 1, :name => "great", :label => "label")
|
20
20
|
@content_view_components = [@content_view_component, @content_view_component2]
|
21
21
|
end
|
22
22
|
|
@@ -5,16 +5,16 @@ module HammerCLIKatello
|
|
5
5
|
describe ContentViewComponent::UpdateCommand do
|
6
6
|
before do
|
7
7
|
@cmd = %w(content-view component update)
|
8
|
-
@component_version = OpenStruct.new(:id => 666, :version => "1.0")
|
9
|
-
@component = OpenStruct.new(:id => 6, :name => "component",
|
10
|
-
|
11
|
-
@content_view_component = OpenStruct.new(:id => 1444,
|
12
|
-
|
13
|
-
|
8
|
+
@component_version = ::OpenStruct.new(:id => 666, :version => "1.0")
|
9
|
+
@component = ::OpenStruct.new(:id => 6, :name => "component",
|
10
|
+
:content_view_version => @component_version)
|
11
|
+
@content_view_component = ::OpenStruct.new(:id => 1444,
|
12
|
+
:content_view => @component,
|
13
|
+
:content_view_version => @component_version)
|
14
14
|
|
15
|
-
@composite = OpenStruct.new(:id => 2, :name => "composite",
|
16
|
-
|
17
|
-
@organization = OpenStruct.new(:id => 1, :name => "great", :label => "label")
|
15
|
+
@composite = ::OpenStruct.new(:id => 2, :name => "composite",
|
16
|
+
:content_view_components => [@content_view_component])
|
17
|
+
@organization = ::OpenStruct.new(:id => 1, :name => "great", :label => "label")
|
18
18
|
end
|
19
19
|
|
20
20
|
def setup_org_expectations
|
@@ -3,10 +3,10 @@ require_relative '../test_helper'
|
|
3
3
|
describe 'content-view create' do
|
4
4
|
before do
|
5
5
|
@cmd = %w(content-view create)
|
6
|
-
@base_params = ["--organization-id=#{org_id}", "--name=#{
|
6
|
+
@base_params = ["--organization-id=#{org_id}", "--name=#{cv_name}"]
|
7
7
|
end
|
8
8
|
let(:error_heading) { "Could not create the content view" }
|
9
|
-
let(:
|
9
|
+
let(:cv_name) { 'test-cv' }
|
10
10
|
let(:org_id) { 1 }
|
11
11
|
let(:repositories) do
|
12
12
|
[
|
@@ -22,7 +22,7 @@ describe 'content-view create' do
|
|
22
22
|
params = %W(--repository-ids=#{ids.join(',')})
|
23
23
|
|
24
24
|
api_expects(:content_views, :create, 'Create content view') do |par|
|
25
|
-
par['name'] ==
|
25
|
+
par['name'] == cv_name &&
|
26
26
|
par['repository_ids'] == ids &&
|
27
27
|
par['organization_id'] == org_id
|
28
28
|
end
|
@@ -11,20 +11,6 @@ describe HammerCLIKatello::Organization::InfoCommand do
|
|
11
11
|
{ "type" => 'network_sync' }
|
12
12
|
end
|
13
13
|
|
14
|
-
it "includes simple content access attributes" do
|
15
|
-
org_id = 2
|
16
|
-
params = ["--id=#{org_id}"]
|
17
|
-
api_expects(:organizations, :index).returns(index_response([{'id' => org_id}]))
|
18
|
-
|
19
|
-
api_expects(:organizations, :show)
|
20
|
-
.with_params('id' => org_id.to_s)
|
21
|
-
.returns("simple_content_access" => true, "id" => org_id,
|
22
|
-
"cdn_configuration" => cdn_configuration)
|
23
|
-
result = run_cmd(@cmd + params)
|
24
|
-
expected = success_result(FieldMatcher.new('Simple Content Access', 'Enabled'))
|
25
|
-
assert_cmd(expected, result)
|
26
|
-
end
|
27
|
-
|
28
14
|
it "includes cdn configuration attributes" do
|
29
15
|
org_id = 2
|
30
16
|
params = ["--id=#{org_id}"]
|
@@ -9,9 +9,8 @@ describe 'update an http proxy on a product' do
|
|
9
9
|
|
10
10
|
let(:sync_response) do
|
11
11
|
{
|
12
|
-
'id' => 1,
|
13
|
-
'state' => 'planned'
|
14
|
-
'action' => 'Update http proxy'
|
12
|
+
'id' => '1',
|
13
|
+
'state' => 'planned'
|
15
14
|
}
|
16
15
|
end
|
17
16
|
|
@@ -23,8 +22,8 @@ describe 'update an http proxy on a product' do
|
|
23
22
|
]
|
24
23
|
|
25
24
|
ex = api_expects(:products_bulk_actions, :update_http_proxy, 'update an http-proxy')
|
26
|
-
.with_params(
|
27
|
-
|
25
|
+
.with_params("ids" => [1], "http_proxy_policy" => "use_selected_http_proxy",
|
26
|
+
"http_proxy_id" => 1)
|
28
27
|
ex.returns(sync_response)
|
29
28
|
|
30
29
|
expect_foreman_task('3')
|
@@ -34,15 +33,10 @@ describe 'update an http proxy on a product' do
|
|
34
33
|
end
|
35
34
|
|
36
35
|
it 'fails with missing required params' do
|
37
|
-
params = ['--proxy-id=1']
|
38
|
-
|
39
|
-
ex = api_expects(:products_bulk_actions, :update_http_proxy, 'update an http-proxy')
|
40
|
-
.with_params('proxy_id' => '1')
|
41
|
-
ex.returns(
|
42
|
-
'proxy_id' => '1'
|
43
|
-
)
|
44
|
-
|
36
|
+
params = ['--http-proxy-id=1']
|
37
|
+
api_expects_no_call
|
45
38
|
result = run_cmd(@cmd + params)
|
46
|
-
|
39
|
+
assert(result.err[/--ids is required/],
|
40
|
+
"ids requirements must be validated")
|
47
41
|
end
|
48
42
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../test_helper')
|
2
|
+
|
3
|
+
describe 'verify checksum on a product' do
|
4
|
+
include ForemanTaskHelpers
|
5
|
+
|
6
|
+
before do
|
7
|
+
@cmd = %w(product verify-checksum)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:sync_response) do
|
11
|
+
{
|
12
|
+
'id' => '1',
|
13
|
+
'state' => 'planned'
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'verifies products ' do
|
18
|
+
params = [
|
19
|
+
'--ids=1'
|
20
|
+
]
|
21
|
+
|
22
|
+
ex = api_expects(:products_bulk_actions, :verify_checksum_products, 'verify checksum')
|
23
|
+
.with_params('ids' => [1])
|
24
|
+
ex.returns(sync_response)
|
25
|
+
|
26
|
+
expect_foreman_task('3')
|
27
|
+
|
28
|
+
result = run_cmd(@cmd + params)
|
29
|
+
assert_equal(HammerCLI::EX_OK, result.exit_code)
|
30
|
+
end
|
31
|
+
end
|
@@ -3,18 +3,18 @@ require_relative '../test_helper'
|
|
3
3
|
describe "create repository" do
|
4
4
|
let(:org_id) { 1 }
|
5
5
|
let(:product_id) { 2 }
|
6
|
-
let(:
|
6
|
+
let(:repo_name) { "repo1" }
|
7
7
|
let(:content_type) { "yum" }
|
8
8
|
|
9
9
|
it 'with basic options' do
|
10
10
|
api_expects(:repositories, :create)
|
11
11
|
.with_params(
|
12
|
-
name:
|
12
|
+
name: repo_name,
|
13
13
|
product_id: product_id,
|
14
14
|
content_type: content_type)
|
15
15
|
|
16
16
|
command = %W(repository create --organization-id #{org_id} --product-id #{product_id}
|
17
|
-
--content-type #{content_type} --name #{
|
17
|
+
--content-type #{content_type} --name #{repo_name})
|
18
18
|
|
19
19
|
assert_equal(0, run_cmd(command).exit_code)
|
20
20
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require_relative '../test_helper'
|
2
|
+
require_relative '../organization/organization_helpers'
|
3
|
+
require 'hammer_cli_katello/repository'
|
4
|
+
module HammerCLIKatello
|
5
|
+
describe Repository::VerifyChecksum do
|
6
|
+
include OrganizationHelpers
|
7
|
+
it 'allows minimal options' do
|
8
|
+
api_expects(:repositories, :verify_checksum) do |p|
|
9
|
+
p['id'] == 1
|
10
|
+
end
|
11
|
+
run_cmd(%w(repository verify-checksum --id 1))
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'resolves repository ID' do
|
15
|
+
it 'by requiring product' do
|
16
|
+
api_expects_no_call
|
17
|
+
result = run_cmd(%w(repository verify-checksum --name repo1))
|
18
|
+
assert(result.err[/--product, --product-id is required/], 'Incorrect error message')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'by product ID' do
|
22
|
+
ex = api_expects(:repositories, :index) do |p|
|
23
|
+
p['name'] == 'repo1' && p['product_id'] == 3
|
24
|
+
end
|
25
|
+
ex.returns(index_response([{'id' => 1}]))
|
26
|
+
|
27
|
+
api_expects(:repositories, :verify_checksum) do |p|
|
28
|
+
p['id'] == 1
|
29
|
+
end
|
30
|
+
|
31
|
+
run_cmd(%w(repository verify-checksum --name repo1 --product-id 3))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'resolves product ID' do
|
36
|
+
it 'by requiring organization options' do
|
37
|
+
api_expects_no_call
|
38
|
+
result = run_cmd(%w(repository verify-checksum --name repo1 --product prod1))
|
39
|
+
assert(result.err[/--organization-id, --organization, --organization-label is required/],
|
40
|
+
"Organization option requirements must be validated")
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'by organization ID' do
|
44
|
+
ex = api_expects(:products, :index) do |p|
|
45
|
+
p['name'] == 'prod3' && p['organization_id'] == '5'
|
46
|
+
end
|
47
|
+
ex.returns(index_response([{'id' => 3}]))
|
48
|
+
|
49
|
+
ex = api_expects(:repositories, :index) do |p|
|
50
|
+
p['name'] == 'repo1' && p['product_id'] == 3
|
51
|
+
end
|
52
|
+
ex.returns(index_response([{'id' => 1}]))
|
53
|
+
|
54
|
+
api_expects(:repositories, :verify_checksum) do |p|
|
55
|
+
p['id'] == 1
|
56
|
+
end
|
57
|
+
|
58
|
+
run_cmd(%w(repository verify-checksum --name repo1 --product prod3 --organization-id 5
|
59
|
+
))
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'by organization name' do
|
63
|
+
expect_organization_search('org5', 5)
|
64
|
+
|
65
|
+
ex = api_expects(:products, :index) do |p|
|
66
|
+
p['name'] == 'prod3' && p['organization_id'] == 5
|
67
|
+
end
|
68
|
+
ex.returns(index_response([{'id' => 3}]))
|
69
|
+
|
70
|
+
ex = api_expects(:repositories, :index) do |p|
|
71
|
+
p['name'] == 'repo1' && p['product_id'] == 3
|
72
|
+
end
|
73
|
+
ex.returns(index_response([{'id' => 1}]))
|
74
|
+
|
75
|
+
api_expects(:repositories, :verify_checksum) do |p|
|
76
|
+
p['id'] == 1
|
77
|
+
end
|
78
|
+
|
79
|
+
run_cmd(%w(repository verify-checksum --name repo1 --product prod3 --organization org5
|
80
|
+
))
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'by organization label' do
|
84
|
+
expect_organization_search('org5', 5, field: 'label')
|
85
|
+
|
86
|
+
ex = api_expects(:products, :index) do |p|
|
87
|
+
p['name'] == 'prod3' && p['organization_id'] == 5
|
88
|
+
end
|
89
|
+
ex.returns(index_response([{'id' => 3}]))
|
90
|
+
|
91
|
+
ex = api_expects(:repositories, :index) do |p|
|
92
|
+
p['name'] == 'repo1' && p['product_id'] == 3
|
93
|
+
end
|
94
|
+
ex.returns(index_response([{'id' => 1}]))
|
95
|
+
|
96
|
+
api_expects(:repositories, :verify_checksum) do |p|
|
97
|
+
p['id'] == 1
|
98
|
+
end
|
99
|
+
|
100
|
+
run_cmd(%w(repository verify-checksum --name repo1 --product prod3 --organization-label org5
|
101
|
+
))
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -2,7 +2,7 @@ require_relative '../test_helper'
|
|
2
2
|
|
3
3
|
describe "create sync plan" do
|
4
4
|
let(:org_id) { 1 }
|
5
|
-
let(:
|
5
|
+
let(:sync_plan_name) { "sync_plan1" }
|
6
6
|
let(:hourly) { "hourly" }
|
7
7
|
let(:custom) { "custom cron" }
|
8
8
|
let(:cron) { "10 * * * *" }
|
@@ -11,11 +11,11 @@ describe "create sync plan" do
|
|
11
11
|
it 'with organization ID,name,interval,date and enabled' do
|
12
12
|
api_expects(:sync_plans, :create, 'create a sync plan').
|
13
13
|
with_params('organization_id' => org_id,
|
14
|
-
'name' =>
|
14
|
+
'name' => sync_plan_name,
|
15
15
|
'interval' => hourly,
|
16
16
|
'sync_date' => date,
|
17
17
|
'enabled' => true)
|
18
|
-
command = %W(sync-plan create --organization-id #{org_id} --name #{
|
18
|
+
command = %W(sync-plan create --organization-id #{org_id} --name #{sync_plan_name}
|
19
19
|
--interval #{hourly} --enabled 1 --sync-date #{date})
|
20
20
|
assert_equal(0, run_cmd(command).exit_code)
|
21
21
|
end
|
@@ -23,19 +23,19 @@ describe "create sync plan" do
|
|
23
23
|
it 'with custom cron' do
|
24
24
|
api_expects(:sync_plans, :create, 'create a sync plan').
|
25
25
|
with_params('organization_id' => org_id,
|
26
|
-
'name' =>
|
26
|
+
'name' => sync_plan_name,
|
27
27
|
'interval' => custom,
|
28
28
|
'cron_expression' => cron,
|
29
29
|
'sync_date' => date,
|
30
30
|
'enabled' => true)
|
31
31
|
# end
|
32
|
-
command = %W(sync-plan create --organization-id #{org_id} --name #{
|
33
|
-
--cron-expression #{cron} --enabled 1 --sync-date #{date})
|
32
|
+
command = %W(sync-plan create --organization-id #{org_id} --name #{sync_plan_name}
|
33
|
+
--interval #{custom} --cron-expression #{cron} --enabled 1 --sync-date #{date})
|
34
34
|
assert_equal(0, run_cmd(command).exit_code)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'fails without organization-id' do
|
38
|
-
command = %w(sync-plan create --name #{
|
38
|
+
command = %w(sync-plan create --name #{sync_plan_name}
|
39
39
|
--interval #{hourly} --enabled 1 --sync-date #{date})
|
40
40
|
refute_equal(0, run_cmd(command).exit_code)
|
41
41
|
end
|
@@ -47,13 +47,13 @@ describe "create sync plan" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'fails without interval' do
|
50
|
-
command = %w(sync-plan create --organization-id #{org_id} --name #{
|
50
|
+
command = %w(sync-plan create --organization-id #{org_id} --name #{sync_plan_name}
|
51
51
|
--enabled 1 --sync-date #{date})
|
52
52
|
refute_equal(0, run_cmd(command).exit_code)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'fails without enabled' do
|
56
|
-
command = %w(sync-plan create --organization-id #{org_id} --name #{
|
56
|
+
command = %w(sync-plan create --organization-id #{org_id} --name #{sync_plan_name}
|
57
57
|
--interval #{hourly} --sync-date #{date})
|
58
58
|
refute_equal(0, run_cmd(command).exit_code)
|
59
59
|
end
|
@@ -8,7 +8,7 @@ describe 'delete a sync plan' do
|
|
8
8
|
|
9
9
|
let(:org_id) { 1 }
|
10
10
|
let(:id) { 1 }
|
11
|
-
let(:
|
11
|
+
let(:sync_plan_name) { "sync_plan1" }
|
12
12
|
let(:org_name) { "org1" }
|
13
13
|
|
14
14
|
it 'by organization ID and sync plan id' do
|
@@ -23,7 +23,7 @@ describe 'delete a sync plan' do
|
|
23
23
|
expect_sync_plan_search(1, 'sync_plan1', 1)
|
24
24
|
api_expects(:sync_plans, :destroy, 'delete a sync plan').
|
25
25
|
with_params('id' => id)
|
26
|
-
command = %W(sync-plan delete --organization-id #{org_id} --name #{
|
26
|
+
command = %W(sync-plan delete --organization-id #{org_id} --name #{sync_plan_name})
|
27
27
|
assert_equal(0, run_cmd(command).exit_code)
|
28
28
|
end
|
29
29
|
|
@@ -32,7 +32,7 @@ describe 'delete a sync plan' do
|
|
32
32
|
expect_sync_plan_search(1, 'sync_plan1', 1)
|
33
33
|
api_expects(:sync_plans, :destroy, 'delete a sync plan').
|
34
34
|
with_params('id' => id)
|
35
|
-
command = %W(sync-plan delete --organization #{org_name} --name #{
|
35
|
+
command = %W(sync-plan delete --organization #{org_name} --name #{sync_plan_name})
|
36
36
|
assert_equal(0, run_cmd(command).exit_code)
|
37
37
|
end
|
38
38
|
|
@@ -8,7 +8,7 @@ describe 'update a sync plan' do
|
|
8
8
|
|
9
9
|
let(:org_id) { 1 }
|
10
10
|
let(:id) { 1 }
|
11
|
-
let(:
|
11
|
+
let(:sync_plan_name) { "sync_plan1" }
|
12
12
|
let(:org_name) { "org1" }
|
13
13
|
let(:desc) { "New Description" }
|
14
14
|
|
@@ -22,22 +22,22 @@ describe 'update a sync plan' do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'with organization ID and sync plan name' do
|
25
|
-
expect_sync_plan_search(org_id,
|
25
|
+
expect_sync_plan_search(org_id, sync_plan_name, id)
|
26
26
|
api_expects(:sync_plans, :update, 'update a sync plan').
|
27
27
|
with_params('description' => desc,
|
28
28
|
'id' => id)
|
29
|
-
command = %W(sync-plan update --organization-id #{org_id} --name #{
|
29
|
+
command = %W(sync-plan update --organization-id #{org_id} --name #{sync_plan_name}
|
30
30
|
--description #{desc})
|
31
31
|
assert_equal(0, run_cmd(command).exit_code)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'with organization name and sync plan name' do
|
35
35
|
expect_organization_search(org_name, org_id)
|
36
|
-
expect_sync_plan_search(org_id,
|
36
|
+
expect_sync_plan_search(org_id, sync_plan_name, id)
|
37
37
|
api_expects(:sync_plans, :update, 'update a sync plan').
|
38
38
|
with_params('description' => desc,
|
39
39
|
'id' => id)
|
40
|
-
command = %W(sync-plan update --organization #{org_name} --name #{
|
40
|
+
command = %W(sync-plan update --organization #{org_name} --name #{sync_plan_name}
|
41
41
|
--description #{desc})
|
42
42
|
assert_equal(0, run_cmd(command).exit_code)
|
43
43
|
end
|