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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9982d40810fde04c8154aa4e1ee164c434009f2c
4
- data.tar.gz: 0e1dd944624427643e1ceadafc0670c97454aa32
3
+ metadata.gz: b469a0c1b03804e5949b45e249f026aeb0708329
4
+ data.tar.gz: 11c6d32d5d89c6547993f4bbc7d241502d68c0a3
5
5
  SHA512:
6
- metadata.gz: b8da139b99e5caa644fb7d348a3a8aa6740b7846ae06a45343a52c03674f67a36a8c461fb227546f95af4441545d550dfebcc630a487832698d413f647c36970
7
- data.tar.gz: f197055dd089c3e3465ef5a641c78d70ef0a857845f1c1ad107b7672cb7cc313571151334a7ae9aaeec2aaa70a373e53f09f1265f472b53365e6e638b045a25e
6
+ metadata.gz: 6746e14273c241b819154ea4b125d2c45040e75fb80749f6ecc6275770b0bf1057f9b12aaa41c6aa0457c5c5939d8ad3f83a50869fc5855f9ff5eefa4bc475a7
7
+ data.tar.gz: 07d2a59289c846869ae92943c6ce7bcab489d23f4a3aa6a219092b185268b97553e20ab20cd33e71a06a5e5f7f7343cb30952e5f2d97d36a903b31154f44cc35
@@ -1 +1,3 @@
1
- module Anvil; end
1
+ require 'Anvil/Client'
2
+ require 'Anvil/Vulnerability'
3
+ require 'faraday'
@@ -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
@@ -0,0 +1,3 @@
1
+ require 'rspec'
2
+ require 'anvil'
3
+ require 'faraday'
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.5
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