appsec_flow_anvil 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/anvil.rb +3 -1
- data/spec/anvil/client_spec.rb +38 -0
- data/spec/anvil/vulnerability_spec.rb +41 -0
- data/spec/anvil/vulnerability_template_spec.rb +31 -0
- data/spec/spec_helper.rb +3 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b469a0c1b03804e5949b45e249f026aeb0708329
|
4
|
+
data.tar.gz: 11c6d32d5d89c6547993f4bbc7d241502d68c0a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6746e14273c241b819154ea4b125d2c45040e75fb80749f6ecc6275770b0bf1057f9b12aaa41c6aa0457c5c5939d8ad3f83a50869fc5855f9ff5eefa4bc475a7
|
7
|
+
data.tar.gz: 07d2a59289c846869ae92943c6ce7bcab489d23f4a3aa6a219092b185268b97553e20ab20cd33e71a06a5e5f7f7343cb30952e5f2d97d36a903b31154f44cc35
|
data/lib/anvil.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'anvil/client'
|
2
|
+
|
3
|
+
describe Anvil::Client do
|
4
|
+
describe '.initialize' do
|
5
|
+
context 'with proper params' do
|
6
|
+
it do
|
7
|
+
expect(Anvil::Client.new('foobar', 'production'))
|
8
|
+
.to be_an_instance_of Anvil::Client
|
9
|
+
end
|
10
|
+
|
11
|
+
it do
|
12
|
+
expect(Anvil::Client.new('foobar', 'production').base_url)
|
13
|
+
.to eq 'https://app.conviso.com.br'
|
14
|
+
end
|
15
|
+
|
16
|
+
it do
|
17
|
+
expect(Anvil::Client.new('foobar', 'staging').base_url)
|
18
|
+
.to eq 'https://homologa.conviso.com.br'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with invalid environment' do
|
23
|
+
it do
|
24
|
+
expect { Anvil::Client.new('foobar', 'wrong_env') }
|
25
|
+
.to raise_error ArgumentError
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '.vulnerabilities' do
|
31
|
+
let(:client) { Anvil::Client.new('foobar', 'staging') }
|
32
|
+
|
33
|
+
it do
|
34
|
+
expect(client.vulnerabilities.create!(foo: 'foo', bar: 'bar'))
|
35
|
+
.to eq 'creating vulnerability'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'anvil/client'
|
2
|
+
require 'anvil/vulnerability'
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Anvil::Vulnerability do
|
6
|
+
let(:client) { Anvil::Client.new('foobar', 'staging') }
|
7
|
+
describe '.initialize' do
|
8
|
+
context 'with proper params' do
|
9
|
+
it do
|
10
|
+
expect(Anvil::Vulnerability.new(client))
|
11
|
+
.to be_an_instance_of Anvil::Vulnerability
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'with invalid params' do
|
16
|
+
it do
|
17
|
+
expect { Anvil::Vulnerability.new('foobar') }
|
18
|
+
.to raise_error ArgumentError
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'create!' do
|
24
|
+
let(:params) do
|
25
|
+
{ client_impact: 'impacto', project_id: 1826, vulnerability_model_id: 10,
|
26
|
+
failure_type: 'code_review', code_review_code: 'code',
|
27
|
+
evidences: ['/myfilse/image.png'] }
|
28
|
+
end
|
29
|
+
|
30
|
+
before do
|
31
|
+
conn = double
|
32
|
+
expect(Faraday).to receive(:new).and_return(conn)
|
33
|
+
expect(conn).to receive(:post).and_return(201)
|
34
|
+
expect(Faraday::UploadIO).to receive(:new).and_return('file')
|
35
|
+
end
|
36
|
+
|
37
|
+
it do
|
38
|
+
expect(Anvil::Vulnerability.new(client).create!(params)).to eq 201
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'anvil/client'
|
2
|
+
require 'anvil/vulnerability_template'
|
3
|
+
|
4
|
+
describe Anvil::VulnerabilityTemplate do
|
5
|
+
let(:client) { Anvil::Client.new('foobar', 'staging') }
|
6
|
+
describe '.initialize' do
|
7
|
+
context 'with proper params' do
|
8
|
+
it do
|
9
|
+
expect(Anvil::VulnerabilityTemplate.new(client))
|
10
|
+
.to be_an_instance_of Anvil::VulnerabilityTemplate
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'with invalid params' do
|
15
|
+
it do
|
16
|
+
expect { Anvil::VulnerabilityTemplate.new('foobar') }
|
17
|
+
.to raise_error ArgumentError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'search' do
|
23
|
+
it "http" do
|
24
|
+
allow(Anvil::VulnerabilityTemplate.new(client).search('foo')).to receive(:body).and_return('the actual body of response')
|
25
|
+
end
|
26
|
+
# it do
|
27
|
+
# expect(Anvil::VulnerabilityTemplate.new(client).search('foo'))
|
28
|
+
# .to eq 'creating vulnerability '
|
29
|
+
# end
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsec_flow_anvil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anezio Campos
|
@@ -63,6 +63,10 @@ files:
|
|
63
63
|
- lib/anvil/client.rb
|
64
64
|
- lib/anvil/vulnerability.rb
|
65
65
|
- lib/anvil/vulnerability_template.rb
|
66
|
+
- spec/anvil/client_spec.rb
|
67
|
+
- spec/anvil/vulnerability_spec.rb
|
68
|
+
- spec/anvil/vulnerability_template_spec.rb
|
69
|
+
- spec/spec_helper.rb
|
66
70
|
homepage: http://app.conviso.com.br
|
67
71
|
licenses:
|
68
72
|
- MIT
|