Virus scanning rest api
This commit is contained in:
parent
e061bcc1fb
commit
3e087ebb07
7 changed files with 100 additions and 14 deletions
18
tests/features/steps/scanning.py
Normal file
18
tests/features/steps/scanning.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from behave import *
|
||||
from hamcrest import *
|
||||
import requests
|
||||
|
||||
@given('I have a file with contents "{contents}"')
|
||||
def step_imp(context, contents):
|
||||
context.file_contents = contents
|
||||
|
||||
@when('I scan the file for a virus')
|
||||
def step_impl(context):
|
||||
files = { 'file': context.file_contents }
|
||||
url = "http://localhost:9000"
|
||||
r = requests.post(url + "/scan", files=files)
|
||||
context.result = r
|
||||
|
||||
@then('I get a http status of "{status}"')
|
||||
def step_impl(context, status):
|
||||
assert_that(int(status), equal_to(context.result.status_code))
|
11
tests/features/virus-scan.feature
Normal file
11
tests/features/virus-scan.feature
Normal file
|
@ -0,0 +1,11 @@
|
|||
Feature: testing virus scanning through rest API
|
||||
|
||||
Scenario Outline: scan files for viruses
|
||||
Given I have a file with contents <content>
|
||||
When I scan the file for a virus
|
||||
Then I get a http status of <status>
|
||||
|
||||
Examples: virus_files
|
||||
| content | status |
|
||||
| "hello_world" | "200" |
|
||||
| "X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*" | "500" |
|
9
tests/requirements.txt
Normal file
9
tests/requirements.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
PyHamcrest==1.8.5
|
||||
argparse==1.2.1
|
||||
behave==1.2.5
|
||||
enum34==1.0.4
|
||||
parse==1.6.6
|
||||
parse-type==0.3.4
|
||||
requests==2.7.0
|
||||
six==1.9.0
|
||||
wsgiref==0.1.2
|
Loading…
Add table
Add a link
Reference in a new issue