nexus_cli_nx 4.1.2
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 +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +41 -0
- data/Guardfile +27 -0
- data/LICENSE +15 -0
- data/README.md +123 -0
- data/Rakefile +1 -0
- data/Thorfile +66 -0
- data/VERSION +1 -0
- data/bin/nexus-cli +10 -0
- data/data/pom.xml.erb +13 -0
- data/features/nexus_oss.feature +259 -0
- data/features/pro/nexus_custom_metadata.feature +116 -0
- data/features/pro/nexus_pro.feature +101 -0
- data/features/step_definitions/cli_steps.rb +105 -0
- data/features/support/env.rb +64 -0
- data/lib/nexus_cli.rb +44 -0
- data/lib/nexus_cli/artifact.rb +44 -0
- data/lib/nexus_cli/base_remote.rb +16 -0
- data/lib/nexus_cli/cli.rb +7 -0
- data/lib/nexus_cli/configuration.rb +101 -0
- data/lib/nexus_cli/connection.rb +84 -0
- data/lib/nexus_cli/errors.rb +259 -0
- data/lib/nexus_cli/mixins/artifact_actions.rb +239 -0
- data/lib/nexus_cli/mixins/global_settings_actions.rb +64 -0
- data/lib/nexus_cli/mixins/logging_actions.rb +45 -0
- data/lib/nexus_cli/mixins/pro/custom_metadata_actions.rb +176 -0
- data/lib/nexus_cli/mixins/pro/smart_proxy_actions.rb +219 -0
- data/lib/nexus_cli/mixins/repository_actions.rb +245 -0
- data/lib/nexus_cli/mixins/user_actions.rb +125 -0
- data/lib/nexus_cli/n3_metadata.rb +77 -0
- data/lib/nexus_cli/remote/oss_remote.rb +11 -0
- data/lib/nexus_cli/remote/pro_remote.rb +59 -0
- data/lib/nexus_cli/remote_factory.rb +30 -0
- data/lib/nexus_cli/tasks.rb +507 -0
- data/lib/nexus_cli/version.rb +6 -0
- data/nexus_cli_nx.gemspec +32 -0
- data/spec/fixtures/metadata_search.xml +10 -0
- data/spec/fixtures/nexus.config +4 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/unit/nexus_cli/artifact_spec.rb +82 -0
- data/spec/unit/nexus_cli/configuration_spec.rb +159 -0
- data/spec/unit/nexus_cli/mixins/pro/custom_metadata_actions_spec.rb +21 -0
- data/spec/unit/nexus_cli/oss_remote_spec.rb +83 -0
- data/spec/unit/nexus_cli/pro_remote_spec.rb +110 -0
- data/spec/unit/nexus_cli/remote_factory_spec.rb +42 -0
- metadata +263 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'nexus_cli/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "nexus_cli_nx"
|
7
|
+
s.version = NexusCli.version
|
8
|
+
s.authors = ["Märt Bakhoff", "Kyle Allan"]
|
9
|
+
s.email = ["anon@sigil.red"]
|
10
|
+
s.homepage = "https://github.com/mbakhoff/nexus_cli_nx"
|
11
|
+
s.summary = %q{A command-line wrapper for making REST calls to Sonatype Nexus. Fork of nexus_cli without chozo/extlib dependencies.}
|
12
|
+
s.description = s.summary
|
13
|
+
s.licenses = ["Apache 2.0"]
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.add_dependency 'thor'
|
21
|
+
s.add_dependency 'httpclient', '~> 2.8.0'
|
22
|
+
s.add_dependency 'json'
|
23
|
+
s.add_dependency 'highline'
|
24
|
+
s.add_dependency 'jsonpath'
|
25
|
+
s.add_runtime_dependency 'activesupport', '~> 3.2.0'
|
26
|
+
|
27
|
+
s.add_development_dependency 'rspec'
|
28
|
+
s.add_development_dependency 'aruba', "= 0.5.0"
|
29
|
+
s.add_development_dependency 'cucumber'
|
30
|
+
s.add_development_dependency 'rake'
|
31
|
+
s.add_development_dependency 'webmock'
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'spork'
|
4
|
+
|
5
|
+
Spork.prefork do
|
6
|
+
require 'webmock/rspec'
|
7
|
+
|
8
|
+
APP_ROOT = File.expand_path('../../', __FILE__)
|
9
|
+
ENV["NEXUS_CONFIG"] = File.join(APP_ROOT, "spec", "fixtures", "nexus.config")
|
10
|
+
end
|
11
|
+
|
12
|
+
Spork.each_run do
|
13
|
+
require 'nexus_cli'
|
14
|
+
end
|
15
|
+
|
16
|
+
def app_root_path
|
17
|
+
Pathname.new(File.expand_path('../..', __FILE__))
|
18
|
+
end
|
19
|
+
|
20
|
+
def fixtures_path
|
21
|
+
app_root_path.join('spec/fixtures')
|
22
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NexusCli::Artifact do
|
4
|
+
|
5
|
+
describe "#new" do
|
6
|
+
it "gives you errors when you under specify" do
|
7
|
+
expect { described_class.new("group:artifact") }.to raise_error(NexusCli::ArtifactMalformedException)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "gives you errors when you over specify" do
|
11
|
+
expect { described_class.new("group:artifact:extension:classifier:version:garbage") }.to raise_error(NexusCli::ArtifactMalformedException)
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when extension and classifier are omitted" do
|
15
|
+
subject { new_artifact }
|
16
|
+
let(:new_artifact) { described_class.new("group:artifact:version") }
|
17
|
+
|
18
|
+
it "creates a new Artifact object" do
|
19
|
+
expect(new_artifact).to be_a(NexusCli::Artifact)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "has the correct attributes" do
|
23
|
+
expect(new_artifact.group_id).to eq("group")
|
24
|
+
expect(new_artifact.artifact_id).to eq("artifact")
|
25
|
+
expect(new_artifact.extension).to eq("jar")
|
26
|
+
expect(new_artifact.classifier).to be_nil
|
27
|
+
expect(new_artifact.version).to eq("version")
|
28
|
+
expect(new_artifact.file_name).to eq("artifact-version.jar")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when just extension is specified" do
|
33
|
+
subject { new_artifact }
|
34
|
+
let(:new_artifact) { described_class.new("group:artifact:extension:version") }
|
35
|
+
|
36
|
+
it "creates a new Artifact object" do
|
37
|
+
expect(new_artifact).to be_a(NexusCli::Artifact)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "has the correct attributes" do
|
41
|
+
expect(new_artifact.group_id).to eq("group")
|
42
|
+
expect(new_artifact.artifact_id).to eq("artifact")
|
43
|
+
expect(new_artifact.extension).to eq("extension")
|
44
|
+
expect(new_artifact.classifier).to be_nil
|
45
|
+
expect(new_artifact.version).to eq("version")
|
46
|
+
expect(new_artifact.file_name).to eq("artifact-version.extension")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when both extension and classifer are specified" do
|
51
|
+
subject { new_artifact }
|
52
|
+
let(:new_artifact) { described_class.new("group:artifact:extension:classifier:version") }
|
53
|
+
|
54
|
+
it "creates a new Artifact object" do
|
55
|
+
expect(new_artifact).to be_a(NexusCli::Artifact)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "has the correct attributes" do
|
59
|
+
expect(new_artifact.group_id).to eq("group")
|
60
|
+
expect(new_artifact.artifact_id).to eq("artifact")
|
61
|
+
expect(new_artifact.extension).to eq("extension")
|
62
|
+
expect(new_artifact.classifier).to eq("classifier")
|
63
|
+
expect(new_artifact.version).to eq("version")
|
64
|
+
expect(new_artifact.file_name).to eq("artifact-version-classifier.extension")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when you specify latest as the version" do
|
69
|
+
subject { new_artifact }
|
70
|
+
let(:new_artifact) { described_class.new("group:artifact:latest") }
|
71
|
+
|
72
|
+
it "upper cases version" do
|
73
|
+
expect(new_artifact.group_id).to eq("group")
|
74
|
+
expect(new_artifact.artifact_id).to eq("artifact")
|
75
|
+
expect(new_artifact.extension).to eq("jar")
|
76
|
+
expect(new_artifact.classifier).to be_nil
|
77
|
+
expect(new_artifact.version).to eq("LATEST")
|
78
|
+
expect(new_artifact.file_name).to eq("artifact-LATEST.jar")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NexusCli::Configuration do
|
4
|
+
subject { configuration }
|
5
|
+
let(:configuration) { described_class }
|
6
|
+
let(:config_instance) { configuration.from_overrides(valid_config) }
|
7
|
+
let(:url) { "http://some-url.com" }
|
8
|
+
let(:repository) { "releases" }
|
9
|
+
let(:username) { "kallan" }
|
10
|
+
let(:password) { "password" }
|
11
|
+
|
12
|
+
let(:valid_config) do
|
13
|
+
{
|
14
|
+
"url" => "http://somewebsite.com",
|
15
|
+
"repository" => "foo",
|
16
|
+
"username" => "admin",
|
17
|
+
"password" => "password"
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "::from_overrides" do
|
22
|
+
subject { from_overrides }
|
23
|
+
let(:from_overrides) { configuration.from_overrides(valid_config) }
|
24
|
+
|
25
|
+
it "returns a new Configuration object" do
|
26
|
+
expect(from_overrides).to be_a(NexusCli::Configuration)
|
27
|
+
end
|
28
|
+
|
29
|
+
context "without username and password" do
|
30
|
+
let(:valid_config) do
|
31
|
+
{
|
32
|
+
"url" => "http://somewebsite.com",
|
33
|
+
"repository" => "foo"
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should not raise an exception" do
|
38
|
+
expect { from_overrides.validate! }.not_to raise_error
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when a config file exists" do
|
43
|
+
let(:from_overrides) { configuration.from_overrides(partial_override) }
|
44
|
+
let(:partial_override) do
|
45
|
+
{
|
46
|
+
"repository" => "foobar"
|
47
|
+
}
|
48
|
+
end
|
49
|
+
let(:partial_config_file) do
|
50
|
+
{
|
51
|
+
"url" => "http://somewebsite.com"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
before do
|
56
|
+
YAML.stub(:load_file).and_return(partial_config_file)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "uses non-overridden parts from the file" do
|
60
|
+
expect(from_overrides.url).to eql("http://somewebsite.com")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "::from_file" do
|
66
|
+
subject { from_file }
|
67
|
+
let(:from_file) { configuration.from_file }
|
68
|
+
|
69
|
+
before do
|
70
|
+
YAML.stub(:load_file).and_return(valid_config)
|
71
|
+
end
|
72
|
+
|
73
|
+
context "when the NEXUS_CONFIG environment variable exists" do
|
74
|
+
let(:nexus_config_path) { "/home/var/nexus_cli" }
|
75
|
+
|
76
|
+
before do
|
77
|
+
ENV['NEXUS_CONFIG'] = nexus_config_path
|
78
|
+
end
|
79
|
+
|
80
|
+
it "loads the config file from NEXUS_CONFIG" do
|
81
|
+
YAML.should_receive(:load_file).with(nexus_config_path)
|
82
|
+
from_file
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "when the NEXUS_CONFIG environment variable does not exist" do
|
87
|
+
let(:nexus_config_path) { File.expand_path(NexusCli::Configuration::DEFAULT_FILE) }
|
88
|
+
|
89
|
+
before do
|
90
|
+
ENV['NEXUS_CONFIG'] = nil
|
91
|
+
end
|
92
|
+
|
93
|
+
it "loads the config file from DEFAULT_FILE" do
|
94
|
+
YAML.should_receive(:load_file).with(nexus_config_path)
|
95
|
+
from_file
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it "returns a new Configuration object" do
|
100
|
+
expect(from_file).to be_a(NexusCli::Configuration)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "::validate!" do
|
105
|
+
subject { validate! }
|
106
|
+
let(:validate!) {described_class.validate!(invalid_config)}
|
107
|
+
let(:invalid_config) do
|
108
|
+
described_class.new(url: nil, repository: "something", username: "someone", password: "somepass")
|
109
|
+
end
|
110
|
+
|
111
|
+
context "when the object is invalide" do
|
112
|
+
it "raises an error" do
|
113
|
+
expect { validate! }.to raise_error(NexusCli::InvalidSettingsException)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "#new" do
|
119
|
+
subject { new_config }
|
120
|
+
let(:new_config) { described_class.new(url: url, repository: repository, username: username, password: password) }
|
121
|
+
|
122
|
+
it "creates a new Configuration object" do
|
123
|
+
expect(new_config).to be_a(NexusCli::Configuration)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "#url" do
|
128
|
+
it "returns the url" do
|
129
|
+
expect(config_instance.url).to eq("http://somewebsite.com")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "#repository" do
|
134
|
+
let(:repository_config) { described_class.new(url: url, repository: repository, username: username, password: password) }
|
135
|
+
|
136
|
+
it "returns the repository" do
|
137
|
+
expect(repository_config.repository).to eq("releases")
|
138
|
+
end
|
139
|
+
|
140
|
+
context "when repository has illegal values" do
|
141
|
+
let(:repository) { "ILLEGAL VALUE" }
|
142
|
+
it "makes it legal" do
|
143
|
+
expect(repository_config.repository).to eq("illegal_value")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "#username" do
|
149
|
+
it "returns the username" do
|
150
|
+
expect(config_instance.username).to eq("admin")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe "#password" do
|
155
|
+
it "returns the password" do
|
156
|
+
expect(config_instance.password).to eq("password")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NexusCli::CustomMetadataActions do
|
4
|
+
let(:custom_metadata_actions) { injected_module.new }
|
5
|
+
let(:injected_module) do
|
6
|
+
Class.new {
|
7
|
+
include NexusCli::CustomMetadataActions
|
8
|
+
}
|
9
|
+
end
|
10
|
+
let(:document) { REXML::Document.new(File.read(fixtures_path.join('metadata_search.xml'))) }
|
11
|
+
|
12
|
+
describe "::get_artifact_array" do
|
13
|
+
subject { get_artifact_array }
|
14
|
+
let(:get_artifact_array) { custom_metadata_actions.send(:get_artifact_array, document) }
|
15
|
+
|
16
|
+
it "returns an array of strings" do
|
17
|
+
get_artifact_array.should be_a(Array)
|
18
|
+
get_artifact_array.each { |element| element.should be_a(String) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
remote = NexusCli::OSSRemote.new(
|
4
|
+
'url' => 'http://localhost:8081/nexus',
|
5
|
+
'repository' => 'releases',
|
6
|
+
'username' => 'admin',
|
7
|
+
'password' => 'admin123'
|
8
|
+
)
|
9
|
+
|
10
|
+
|
11
|
+
fake_xml = <<EOS
|
12
|
+
<search-results>
|
13
|
+
<totalCount>1</totalCount>
|
14
|
+
<from>-1</from>
|
15
|
+
<count>-1</count>
|
16
|
+
<tooManyResults>false</tooManyResults>
|
17
|
+
<data>
|
18
|
+
<artifact>
|
19
|
+
<resourceURI>https://someuri.com/com/something/thing.tgz</resourceURI>
|
20
|
+
<groupId>com.something</groupId>
|
21
|
+
<artifactId>thing-stuff</artifactId>
|
22
|
+
<version>0.4.0</version>
|
23
|
+
<packaging>tgz</packaging>
|
24
|
+
<extension>tgz</extension>
|
25
|
+
<repoId>company_artifact</repoId>
|
26
|
+
<contextId>Company Replicated Artifacts</contextId>
|
27
|
+
<pomLink>https://somedomain.com/nexus/service/local/artifact/maven/redirect?r=company_artifact&g=com.something&a=thing-stuff&v=0.4.0&e=pom</pomLink>
|
28
|
+
<artifactLink>https://somedomain/nexus/service/local/artifact/maven/redirect?r=ompany_artifact&g=com.something&a=thing-stuff&v=0.4.0&e=tgz</artifactLink>
|
29
|
+
</artifact>
|
30
|
+
</data>
|
31
|
+
</search-results>
|
32
|
+
EOS
|
33
|
+
|
34
|
+
describe NexusCli do
|
35
|
+
it "gives you errors when you attempt to pull an artifact don't give a valid artifact name" do
|
36
|
+
expect {remote.pull_artifact "com.something:something", nil}.to raise_error(NexusCli::ArtifactMalformedException)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "gives you errors when you attempt to get an artifact's info and don't give a valid artifact name" do
|
40
|
+
expect {remote.get_artifact_info "com.something:something"}.to raise_error(NexusCli::ArtifactMalformedException)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "gives you errors when you attempt to pull an artifact and it cannot be found" do
|
44
|
+
HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
45
|
+
expect {remote.pull_artifact "com.something:something:tgz:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "gives you errors when you attempt to get an artifact's info and it cannot be found" do
|
49
|
+
HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
50
|
+
expect {remote.get_artifact_info "com.something:something:tgz:1.0.0"}.to raise_error(NexusCli::ArtifactNotFoundException)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "gives you errors when you attempt to pull an artifact with classifier and it cannot be found" do
|
54
|
+
HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
55
|
+
expect {remote.pull_artifact "com.something:something:tgz:x64:1.0.0", nil}.to raise_error(NexusCli::ArtifactNotFoundException)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "gives you an error when you try to update a user that doesnt exist" do
|
59
|
+
stub_request(:get, "http://localhost:8081/nexus/service/local/users/qwertyasdf").
|
60
|
+
with(:headers => {
|
61
|
+
'Accept' => 'application/json',
|
62
|
+
'Authorization' => 'Basic YWRtaW46YWRtaW4xMjM='
|
63
|
+
}).to_return(:status => 404, :body => "", :headers => {})
|
64
|
+
|
65
|
+
expect {
|
66
|
+
remote.update_user(:userId => "qwertyasdf")
|
67
|
+
}.to raise_error(NexusCli::UserNotFoundException)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "gives you an error when you try to set the logging level to something weird" do
|
71
|
+
expect {remote.set_logger_level("weird")}.to raise_error(NexusCli::InvalidLoggingLevelException)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "will return raw xml from the search command" do
|
75
|
+
stub_request(:get, "http://localhost:8081/nexus/service/local/data_index?a=something&g=com.something").to_return(:status => 200, :body => fake_xml, :headers => {})
|
76
|
+
expect(remote.search_for_artifacts("com.something:something")).to eq fake_xml
|
77
|
+
end
|
78
|
+
|
79
|
+
it "gives you errors when you attempt to get an artifact's download url and it cannot be found" do
|
80
|
+
HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
81
|
+
expect {remote.get_artifact_download_url "com.something:something:tgz:1.0.0"}.to raise_error(NexusCli::ArtifactNotFoundException)
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'nexus_cli'
|
2
|
+
|
3
|
+
describe NexusCli::ProRemote do
|
4
|
+
let(:remote) do
|
5
|
+
NexusCli::ProRemote.new(
|
6
|
+
'url' => 'http://localhost:8081/nexus',
|
7
|
+
'repository' => 'releases',
|
8
|
+
'username' => 'admin',
|
9
|
+
'password' => 'admin123'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "gives you errors when you attempt to get an artifact's custom info and don't give a valid artifact name" do
|
14
|
+
expect {remote.get_artifact_custom_info("com.something:something")}.to raise_error(NexusCli::ArtifactMalformedException)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "gives you errors when you attempt to get an artifact's custom info and it cannot be found" do
|
18
|
+
HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
19
|
+
expect {remote.get_artifact_custom_info("com.something:something:tgz:1.0.0")}.to raise_error(NexusCli::ArtifactNotFoundException)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "gives you errors when you attempt to update an artifact's custom info and don't give valid parameters" do
|
23
|
+
expect {remote.update_artifact_custom_info("com.something:something:tgz:1.0.0", "_somebadkey:_somebadvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "gives you errors when you attempt to update an artifact's custom info and don't give valid parameters" do
|
27
|
+
expect {remote.update_artifact_custom_info("com.something:something:tgz:1.0.0", "_somebadkey")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "gives you errors when you attempt to clear an artifact's custom info and it cannot be found" do
|
31
|
+
HTTPClient.any_instance.stub(:get).and_raise(NexusCli::ArtifactNotFoundException)
|
32
|
+
expect {remote.clear_artifact_custom_info("com.something:something:tgz:1.0.0")}.to raise_error(NexusCli::ArtifactNotFoundException)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "gives you errors when you attempt to search for artifacts using custom info and don't give valid key" do
|
36
|
+
expect {remote.search_artifacts_custom("somekey_:equal:somevalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "gives you errors when you attempt to search for artifacts using custom info and don't give valid value" do
|
40
|
+
expect {remote.search_artifacts_custom("somekey:equal:somevalue \"\'\\/")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "gives you errors when you attempt to search for artifacts using custom info and don't give valid search type" do
|
44
|
+
expect {remote.search_artifacts_custom("somekey:equals:somevalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "gives you errors when you attempt to search for artifacts using custom info and don't give valid parameters" do
|
48
|
+
expect {remote.search_artifacts_custom("somekey")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "tests for custom metadata private helper methods" do
|
52
|
+
it "gives you errors when you attempt to parse custom metadata with bad update keys" do
|
53
|
+
expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "badkey_:goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "gives you errors when you attempt to parse custom metadata with missing update keys" do
|
57
|
+
expect {remote.send(:parse_custom_metadata_update_params, ":goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "gives you errors when you attempt to parse custom metadata with typo" do
|
61
|
+
expect {remote.send(:parse_custom_metadata_update_params, "goodkeygoodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "gives you errors when you attempt to parse custom metadata with bad update values" do
|
65
|
+
expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "goodkey:badvalue\"'\\")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "gives you errors when you attempt to parse custom metadata with missing search type and value" do
|
69
|
+
expect {remote.send(:parse_custom_metadata_search_params, "goodkey")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "gives you errors when you attempt to parse custom metadata with bad search type" do
|
73
|
+
expect {remote.send(:parse_custom_metadata_search_params, "goodkey:eq:goodvalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "gives you errors when you attempt to parse custom metadata with bad search value" do
|
77
|
+
expect {remote.send(:parse_custom_metadata_search_params, "goodkey:equals:badvalue\"'\\")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "tests for custom metadata private helper methods" do
|
82
|
+
it "gives you errors when you attempt to parse custom metadata with bad update keys" do
|
83
|
+
expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "badkey_:goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "gives you errors when you attempt to parse custom metadata with missing update keys" do
|
87
|
+
expect {remote.send(:parse_custom_metadata_update_params, ":goodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "gives you errors when you attempt to parse custom metadata with typo" do
|
91
|
+
expect {remote.send(:parse_custom_metadata_update_params, "goodkeygoodvalue")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "gives you errors when you attempt to parse custom metadata with bad update values" do
|
95
|
+
expect {remote.send(:parse_custom_metadata_update_params, "goodkey:goodvalue", "goodkey:badvalue\"'\\")}.to raise_error(NexusCli::N3ParameterMalformedException)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "gives you errors when you attempt to parse custom metadata with missing search type and value" do
|
99
|
+
expect {remote.send(:parse_custom_metadata_search_params, "goodkey")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "gives you errors when you attempt to parse custom metadata with bad search type" do
|
103
|
+
expect {remote.send(:parse_custom_metadata_search_params, "goodkey:eq:goodvalue")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "gives you errors when you attempt to parse custom metadata with bad search value" do
|
107
|
+
expect {remote.send(:parse_custom_metadata_search_params, "goodkey:equals:badvalue\"'\\")}.to raise_error(NexusCli::SearchParameterMalformedException)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|