Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- describe 'VirusTotal Public API' do
- url = Airborne.configuration.virus_total_url
- api_key = Airborne.configuration.virus_total_api_key
- resource = Airborne.configuration.virus_total_resource
- context 'RESCAN' do
- before(:all) do
- @tap = Airborne::TapcoreApi.new(url)
- @tap.virus_total_rescan(url, api_key, resource)
- end
- context 'RESPONSE' do
- it 'should be set' do
- expect(response).to_not be(nil)
- end
- end
- context 'HEADERS' do
- it 'should be set' do
- puts "Response headers: #{headers}"
- expect(headers).to_not be(nil)
- end
- it 'correct content-type' do
- expect_header('content-type', 'application/json')
- end
- end
- context 'BODY' do
- it 'should be set' do
- puts "Response body: #{body}"
- puts "Response body size: #{body.size} B"
- expect(body).to_not be(nil)
- end
- end
- context 'STATUS' do
- it 'should be set' do
- expect(status).to_not be(nil)
- end
- it 'correct status' do
- expect_status 200
- end
- end
- context 'JSON' do
- it 'should be set' do
- expect(body).to_not be(nil)
- end
- it 'correct response code value' do
- expect(json_body[:response_code]).to eq(1)
- end
- end
- context 'RESPONSE TIME' do
- it 'correct response time' do
- puts "Response time: #{response_time} sec"
- expect(response_time).to be < 20
- end
- end
- end
- context 'REPORT' do
- before(:all) do
- @tap = Airborne::TapcoreApi.new(url)
- @tap.virus_total_report(url, api_key, resource)
- end
- context 'RESPONSE' do
- it 'should be set' do
- expect(response).to_not be(nil)
- end
- end
- context 'HEADERS' do
- it 'should be set' do
- puts "Response headers: #{headers}"
- expect(headers).to_not be(nil)
- end
- it 'correct content-type' do
- expect_header('content-type', 'application/json')
- end
- end
- context 'BODY' do
- it 'should be set' do
- puts "Response body: #{body}"
- puts "Response body size: #{body.size} B"
- expect(body).to_not be(nil)
- end
- end
- context 'STATUS' do
- it 'should be set' do
- expect(status).to_not be(nil)
- end
- it 'correct status' do
- expect_status 200
- end
- end
- context 'JSON' do
- it 'should be set' do
- expect(body).to_not be(nil)
- end
- it 'correct response code value' do
- expect(json_body[:response_code]).to eq(1)
- end
- it 'correct positives value' do
- expect(json_body[:positives]).to be <= 1
- end
- end
- context 'RESPONSE TIME' do
- it 'correct response time' do
- puts "Response time: #{response_time} sec"
- expect(response_time).to be < 20
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment