virus-scanner 0.0.4 → 0.0.5

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: 239b452109a2e4f1321fffdb84b4b0033e301ca0
4
- data.tar.gz: 55421eb521cd733a058b530392b1eb94f1c6c537
3
+ metadata.gz: 7409a7db68051f85d742579ed2186da7958499c7
4
+ data.tar.gz: eb597689a9dae6483f824116b21e7f18373bef87
5
5
  SHA512:
6
- metadata.gz: c7b44d47c41465c6089570acd87af73c87cc4a2e6540dac76981adc17e05be7d45d47ba852298a96bd151de416b48ea40de397cbb7c7b69adaeffc91f102d964
7
- data.tar.gz: d36347019c66b4a8e0662219fc1def32f3e8ad58a2c59ba9e4b5fb651782b6eb134040a3717c7ab6ed091d00c65200c4afbb5e50d335494124919dcaaefa695c
6
+ metadata.gz: bb59c64532036a8cd8d5eb73f8a1d5847723a8e8493c7541c7fb0ff347fa9eec3fa03af0762c4b730a8f4f07a828abd4f6b80d3dda0337b241913d7ac0fd55a6
7
+ data.tar.gz: 2988217ff9f87c9778a0df6a6e1d1b4363e488ab965dbec3e5afd9767bbc55593b392b8e0563fa3281da5f37adb9f4a3b59e1e33ae9ac6ba8c1024e11fb4ff10
@@ -1,9 +1,9 @@
1
1
  module VirusScanner
2
2
  class File
3
3
  attr_accessor :body
4
- def self.scan_url(url)
5
- # Pass URL to file to check to the HTTP requests handler
6
- body = handler.post(url)
4
+ def self.scan_url(uuid, url)
5
+ # Pass UUID and URL to file to check to the HTTP requests handler
6
+ body = handler.post(uuid, url)
7
7
 
8
8
  body
9
9
  end
@@ -13,8 +13,8 @@ module VirusScanner
13
13
  handle_exception(e)
14
14
  end
15
15
 
16
- def post(url)
17
- response = @conn.post "/scan", url: url
16
+ def post(uuid, url)
17
+ response = @conn.post "/scan", uuid: uuid, url: url
18
18
  response.body
19
19
  rescue VirusScanner::Error => e
20
20
  handle_exception(e)
@@ -1,3 +1,3 @@
1
1
  module VirusScanner
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -3,11 +3,12 @@ require_relative "./test_helper.rb"
3
3
  describe VirusScanner::File do
4
4
  describe "#check_from_url" do
5
5
  it "returns info about scan job" do
6
- response = { "status" => "scanning", "id" => "de401fdf-08b0-44a8-810b-20794c5c98c7" }
6
+ response = { "status" => "scanning" }
7
7
  VirusScanner::HTTP.any_instance.stubs(:post).returns(response)
8
- assert_equal(VirusScanner::File.scan_url("url-to-suspected-file"),
9
- "status" => "scanning",
10
- "id" => "de401fdf-08b0-44a8-810b-20794c5c98c7")
8
+ assert_equal(VirusScanner::File.scan_url(
9
+ "de401fdf-08b0-44a8-810b-20794c5c98c7",
10
+ "url-to-suspected-file"
11
+ ),"status" => "scanning")
11
12
  end
12
13
  end
13
14
 
@@ -4,14 +4,15 @@ ENV["VIRUS_SCANNER_API_URL"] = "http://localhost:3000"
4
4
 
5
5
  describe VirusScanner::HTTP do
6
6
  describe "#post" do
7
- it "returns id of job if posted with success" do
7
+ it "returns status of job if posted with success" do
8
8
  # stub POST request for providing URL to files for scan
9
9
  stub_request(:post, "localhost:3000/scan").to_return(
10
10
  body:
11
- { id: "de401fdf-08b0-44a8-810b-20794c5c98c7" }.to_json)
11
+ { status: "scanning" }.to_json)
12
12
 
13
- # check if stubbed URL provides id for scan job
14
- assert_includes(VirusScanner::HTTP.new.post("url"), "de401fdf-08b0-44a8-810b-20794c5c98c7")
13
+ # check if stubbed URL provides status for scan job
14
+ scan_request = VirusScanner::HTTP.new.post("de401fdf-08b0-44a8-810b-20794c5c98c7", "url")
15
+ assert_includes(scan_request["status"], "scanning")
15
16
  end
16
17
  end
17
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virus-scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - BitZesty Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday