veracode-api 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ require (File.expand_path('./../../../spec_helper', __FILE__))
2
+
3
+ describe Veracode::API::Base do
4
+
5
+ describe "default attributes" do
6
+
7
+ it "must include httparty methods" do
8
+ Veracode::API::Base.must_include HTTParty
9
+ end
10
+
11
+ it "must have the base url set to the Veracode API endpoint" do
12
+ Veracode::API::Base.base_uri.must_equal 'https://analysiscenter.veracode.com'
13
+ end
14
+ end
15
+
16
+ describe "default instance attributes" do
17
+
18
+ let(:veracode) { Veracode::API::Base.new(:username => "veracode", :password => "password") }
19
+
20
+ it "must have an id attribute" do
21
+ veracode.must_respond_to :username
22
+ end
23
+
24
+ it "must have the right id" do
25
+ veracode.username.must_equal 'veracode'
26
+ end
27
+
28
+ it "must have an password attribute" do
29
+ veracode.must_respond_to :password
30
+ end
31
+
32
+ #it "must have the right password" do
33
+ # veracode.passwword.must_equal 'password'
34
+ #end
35
+
36
+ end
37
+ end
@@ -0,0 +1,35 @@
1
+ require (File.expand_path('./../../../spec_helper', __FILE__))
2
+
3
+ describe Veracode::API::Results do
4
+ describe "GET builds" do
5
+
6
+ let(:veracode) { Veracode::API::Results.new(:username => "test", :password => "test") }
7
+
8
+ before do
9
+ VCR.insert_cassette 'base', :record => :new_episodes
10
+ end
11
+
12
+ after do
13
+ VCR.eject_cassette
14
+ end
15
+
16
+ it "must have a get_application_builds method" do
17
+ veracode.must_respond_to :get_application_builds
18
+ end
19
+
20
+ it "must parse the api response from XML to Veracode::Result::Builds::Applications" do
21
+ veracode.get_application_builds.must_be_instance_of Veracode::Result::Builds::Applications
22
+ end
23
+
24
+ describe "dynamic attributes for builds" do
25
+
26
+ before do
27
+ @builds = veracode.get_application_builds
28
+ end
29
+
30
+ it "must raise method missing if attribute is not present" do
31
+ lambda { @builds.foo_attribute }.must_raise NoMethodError
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,24 @@
1
+ require (File.expand_path('./../../../spec_helper', __FILE__))
2
+
3
+ describe Veracode::API::Results do
4
+ describe "GET Call Stack" do
5
+
6
+ let(:veracode) { Veracode::API::Results.new(:username => "test", :password => "test") }
7
+
8
+ before do
9
+ VCR.insert_cassette 'base', :record => :new_episodes
10
+ end
11
+
12
+ after do
13
+ VCR.eject_cassette
14
+ end
15
+
16
+ it "must have a get_callstacks method" do
17
+ veracode.must_respond_to :get_callstacks
18
+ end
19
+
20
+ it "must parse the api response from XML to Veracode::Result::CallStacks" do
21
+ veracode.get_callstacks("44905", "132").must_be_instance_of Veracode::Result::CallStacks
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,65 @@
1
+ require (File.expand_path('./../../../spec_helper', __FILE__))
2
+
3
+ describe Veracode::API::Results do
4
+ describe "GET detailed report" do
5
+
6
+ let(:veracode) { Veracode::API::Results.new(:username => "test", :password => "test") }
7
+
8
+ before do
9
+ VCR.insert_cassette 'base', :record => :new_episodes
10
+ end
11
+
12
+ after do
13
+ VCR.eject_cassette
14
+ end
15
+
16
+ it "must have a get_detailed_report method" do
17
+ veracode.must_respond_to :get_detailed_report
18
+ end
19
+
20
+ it "must parse the api response from XML to Veracode::Result::DetailedReport" do
21
+ veracode.get_detailed_report("44905").must_be_instance_of Veracode::Result::DetailedReport
22
+ end
23
+
24
+ describe "dynamic attributes for results" do
25
+
26
+ before do
27
+ @result = veracode.get_detailed_report("44905")
28
+ end
29
+
30
+ it "must return the attribute value if present" do
31
+ @result.app_name.must_equal "WebGoat"
32
+ end
33
+
34
+ it "must be an instance of Veracode::Result::Analysis" do
35
+ @result.static_analysis.must_be_instance_of Veracode::Result::Analysis
36
+ end
37
+
38
+ it "must be an instance of Veracode::Result::Analysis" do
39
+ @result.dynamic_analysis.must_be_instance_of Veracode::Result::Analysis
40
+ end
41
+
42
+ it "must be an instance of Veracode::Result::ManualAnalysis" do
43
+ @result.manual_analysis.must_be_instance_of Veracode::Result::ManualAnalysis
44
+ end
45
+
46
+ it "must be an instance of Veracode::Result::FlawStatus" do
47
+ @result.flaw_status.must_be_instance_of Veracode::Result::FlawStatus
48
+ end
49
+
50
+ it "must be an instance of Veracode::Result::Severity" do
51
+ @result.severity.each do |sev|
52
+ sev.must_be_instance_of Veracode::Result::Severity
53
+ end
54
+ end
55
+
56
+ it "must be an instance of TrueClass" do
57
+ @result.is_latest_build?.must_be_instance_of TrueClass
58
+ end
59
+
60
+ it "must raise method missing if attribute is not present" do
61
+ lambda { @result.foo_attribute }.must_raise NoMethodError
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,65 @@
1
+ require (File.expand_path('./../../../spec_helper', __FILE__))
2
+
3
+ describe Veracode::API::Results do
4
+ describe "GET summary report" do
5
+
6
+ let(:veracode) { Veracode::API::Results.new(:username => "test", :password => "test") }
7
+
8
+ before do
9
+ VCR.insert_cassette 'base', :record => :new_episodes
10
+ end
11
+
12
+ after do
13
+ VCR.eject_cassette
14
+ end
15
+
16
+ it "must have a get_summary_report method" do
17
+ veracode.must_respond_to :get_summary_report
18
+ end
19
+
20
+ it "must parse the api response from XML to Veracode::Result::SummaryReport" do
21
+ veracode.get_summary_report("44905").must_be_instance_of Veracode::Result::SummaryReport
22
+ end
23
+
24
+ describe "dynamic attributes for results" do
25
+
26
+ before do
27
+ @result = veracode.get_summary_report("44905")
28
+ end
29
+
30
+ it "must return the attribute value if present" do
31
+ @result.app_name.must_equal "WebGoat"
32
+ end
33
+
34
+ it "must be an instance of Veracode::Result::Analysis" do
35
+ @result.static_analysis.must_be_instance_of Veracode::Result::Analysis
36
+ end
37
+
38
+ it "must be an instance of Veracode::Result::Analysis" do
39
+ @result.dynamic_analysis.must_be_instance_of Veracode::Result::Analysis
40
+ end
41
+
42
+ it "must be an instance of Veracode::Result::ManualAnalysis" do
43
+ @result.manual_analysis.must_be_instance_of Veracode::Result::ManualAnalysis
44
+ end
45
+
46
+ it "must be an instance of Veracode::Result::FlawStatus" do
47
+ @result.flaw_status.must_be_instance_of Veracode::Result::FlawStatus
48
+ end
49
+
50
+ it "must be an instance of Veracode::Result::SummarySeverity" do
51
+ @result.severity.each do |sev|
52
+ sev.must_be_instance_of Veracode::Result::SummarySeverity
53
+ end
54
+ end
55
+
56
+ it "must be an instance of TrueClass" do
57
+ @result.is_latest_build?.must_be_instance_of TrueClass
58
+ end
59
+
60
+ it "must raise method missing if attribute is not present" do
61
+ lambda { @result.foo_attribute }.must_raise NoMethodError
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,74 @@
1
+ require (File.expand_path('./../../../spec_helper', __FILE__))
2
+
3
+ describe Veracode::API::Upload do
4
+ describe "GET build information" do
5
+
6
+ let(:veracode) { Veracode::API::Upload.new(:username => "test", :password => "test") }
7
+
8
+ before do
9
+ VCR.insert_cassette 'base', :record => :new_episodes
10
+ end
11
+
12
+ after do
13
+ VCR.eject_cassette
14
+ end
15
+
16
+ it "must have a get_application_list method" do
17
+ veracode.must_respond_to :get_application_list
18
+ end
19
+
20
+ it "must parse the api response from XML to Veracode::Upload::ApplicationInfo" do
21
+ veracode.get_application_info("32338").must_be_instance_of Veracode::Upload::ApplicationInfo
22
+ end
23
+
24
+ it "must parse the api response from XML to Veracode::Upload::AppList" do
25
+ veracode.get_application_list.must_be_instance_of Veracode::Upload::AppList
26
+ end
27
+
28
+ describe "dynamic attributes for build info" do
29
+
30
+ before do
31
+ @result = veracode.get_build_info("32338", "44905")
32
+ end
33
+
34
+ it "must parse the api response from XML to Veracode::Upload::BuildInfo" do
35
+ @result.must_be_instance_of Veracode::Upload::BuildInfo
36
+ end
37
+
38
+ it "must return the attribute value if present" do
39
+ @result.app_id.must_equal "32338"
40
+ end
41
+
42
+ it "must be an instance of Veracode::Upload::Build" do
43
+ @result.build.must_be_instance_of Veracode::Upload::Build
44
+ end
45
+
46
+ it "must be an instance of TrueClass" do
47
+ @result.build.results_ready?.must_be_instance_of TrueClass
48
+ end
49
+
50
+ it "must raise method missing if attribute is not present" do
51
+ lambda { @result.foo_attribute }.must_raise NoMethodError
52
+ end
53
+ end
54
+
55
+ describe "dynamic attributes for build list" do
56
+
57
+ before do
58
+ @result = veracode.get_build_list("32338")
59
+ end
60
+
61
+ it "must parse the api response from XML to Veracode::Upload::BuildList" do
62
+ @result.must_be_instance_of Veracode::Upload::BuildList
63
+ end
64
+
65
+ it "must return the attribute value if present" do
66
+ @result.app_id.must_equal "32338"
67
+ end
68
+
69
+ it "must raise method missing if attribute is not present" do
70
+ lambda { @result.foo_attribute }.must_raise NoMethodError
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,25 @@
1
+ #we need the actual library file
2
+ # require_relative '../lib/veracode'
3
+ # For Ruby < 1.9.3, use this instead of require_relative
4
+ require(File.expand_path('../../lib/veracode-api', __FILE__))
5
+
6
+ #dependencies
7
+ require 'minitest/autorun'
8
+ require 'webmock/minitest'
9
+ require 'vcr'
10
+ require 'turn'
11
+
12
+ Turn.config do |c|
13
+ # :outline - turn's original case/test outline mode [default]
14
+ c.format = :outline
15
+ # turn on invoke/execute tracing, enable full backtrace
16
+ c.trace = true
17
+ # use humanized test names (works only with :outline format)
18
+ c.natural = true
19
+ end
20
+
21
+ #VCR config
22
+ VCR.config do |c|
23
+ c.cassette_library_dir = 'spec/fixtures/veracode_cassettes'
24
+ c.stub_with :webmock
25
+ end
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "veracode/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "veracode-api"
7
+ s.version = Veracode::API::VERSION
8
+ s.authors = ["Stephen Kapp"]
9
+ s.email = ["mort666@virus.org"]
10
+ s.homepage = "https://github.com/mort666/veracode-api"
11
+ s.summary = %q{Veracode Analysis Service API Wrapper}
12
+ s.description = %q{Ruby API Wrapper to access Veracode Security Analysis Service API}
13
+
14
+ s.rubyforge_project = "veracode-api"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "httparty"
22
+ s.add_dependency "nori"
23
+ s.add_dependency "nokogiri"
24
+ s.add_dependency "xml-simple"
25
+ s.add_dependency "roxml"
26
+ s.add_dependency "i18n"
27
+
28
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: veracode-api
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 1
9
+ version: 0.4.1
10
+ platform: ruby
11
+ authors:
12
+ - Stephen Kapp
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-01-27 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httparty
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: nori
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: nokogiri
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ name: xml-simple
58
+ prerelease: false
59
+ requirement: &id004 !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ type: :runtime
67
+ version_requirements: *id004
68
+ - !ruby/object:Gem::Dependency
69
+ name: roxml
70
+ prerelease: false
71
+ requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ type: :runtime
79
+ version_requirements: *id005
80
+ - !ruby/object:Gem::Dependency
81
+ name: i18n
82
+ prerelease: false
83
+ requirement: &id006 !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :runtime
91
+ version_requirements: *id006
92
+ description: Ruby API Wrapper to access Veracode Security Analysis Service API
93
+ email:
94
+ - mort666@virus.org
95
+ executables: []
96
+
97
+ extensions: []
98
+
99
+ extra_rdoc_files: []
100
+
101
+ files:
102
+ - .gitignore
103
+ - Gemfile
104
+ - LICENSE
105
+ - README.md
106
+ - Rakefile
107
+ - lib/veracode-api.rb
108
+ - lib/veracode/admin.rb
109
+ - lib/veracode/api/builds.rb
110
+ - lib/veracode/api/call_stack.rb
111
+ - lib/veracode/api/detailed.rb
112
+ - lib/veracode/api/flaws.rb
113
+ - lib/veracode/api/summary.rb
114
+ - lib/veracode/api/types.rb
115
+ - lib/veracode/api/upload.rb
116
+ - lib/veracode/base.rb
117
+ - lib/veracode/config.rb
118
+ - lib/veracode/parser/parser.rb
119
+ - lib/veracode/results.rb
120
+ - lib/veracode/upload.rb
121
+ - lib/veracode/version.rb
122
+ - spec/fixtures/veracode_cassettes/base.yml
123
+ - spec/lib/veracode/base_spec.rb
124
+ - spec/lib/veracode/builds_spec.rb
125
+ - spec/lib/veracode/call_stack_spec.rb
126
+ - spec/lib/veracode/detailed_spec.rb
127
+ - spec/lib/veracode/summary_spec.rb
128
+ - spec/lib/veracode/upload_spec.rb
129
+ - spec/spec_helper.rb
130
+ - veracode-api.gemspec
131
+ has_rdoc: true
132
+ homepage: https://github.com/mort666/veracode-api
133
+ licenses: []
134
+
135
+ post_install_message:
136
+ rdoc_options: []
137
+
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ segments:
145
+ - 0
146
+ version: "0"
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ segments:
152
+ - 0
153
+ version: "0"
154
+ requirements: []
155
+
156
+ rubyforge_project: veracode-api
157
+ rubygems_version: 1.3.6
158
+ signing_key:
159
+ specification_version: 3
160
+ summary: Veracode Analysis Service API Wrapper
161
+ test_files:
162
+ - spec/fixtures/veracode_cassettes/base.yml
163
+ - spec/lib/veracode/base_spec.rb
164
+ - spec/lib/veracode/builds_spec.rb
165
+ - spec/lib/veracode/call_stack_spec.rb
166
+ - spec/lib/veracode/detailed_spec.rb
167
+ - spec/lib/veracode/summary_spec.rb
168
+ - spec/lib/veracode/upload_spec.rb
169
+ - spec/spec_helper.rb