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 +4 -4
- data/lib/virus_scanner/file.rb +3 -3
- data/lib/virus_scanner/http.rb +2 -2
- data/lib/virus_scanner/version.rb +1 -1
- data/test/file_test.rb +5 -4
- data/test/http_test.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7409a7db68051f85d742579ed2186da7958499c7
|
4
|
+
data.tar.gz: eb597689a9dae6483f824116b21e7f18373bef87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb59c64532036a8cd8d5eb73f8a1d5847723a8e8493c7541c7fb0ff347fa9eec3fa03af0762c4b730a8f4f07a828abd4f6b80d3dda0337b241913d7ac0fd55a6
|
7
|
+
data.tar.gz: 2988217ff9f87c9778a0df6a6e1d1b4363e488ab965dbec3e5afd9767bbc55593b392b8e0563fa3281da5f37adb9f4a3b59e1e33ae9ac6ba8c1024e11fb4ff10
|
data/lib/virus_scanner/file.rb
CHANGED
@@ -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
|
data/lib/virus_scanner/http.rb
CHANGED
@@ -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)
|
data/test/file_test.rb
CHANGED
@@ -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"
|
6
|
+
response = { "status" => "scanning" }
|
7
7
|
VirusScanner::HTTP.any_instance.stubs(:post).returns(response)
|
8
|
-
assert_equal(VirusScanner::File.scan_url(
|
9
|
-
|
10
|
-
|
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
|
|
data/test/http_test.rb
CHANGED
@@ -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
|
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
|
-
{
|
11
|
+
{ status: "scanning" }.to_json)
|
12
12
|
|
13
|
-
# check if stubbed URL provides
|
14
|
-
|
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
|
+
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-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|