forked from benevolentprof/inf1340_2015_asst3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_exercise2.py
70 lines (36 loc) · 1.56 KB
/
test_exercise2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
""" Module to test papers.py """
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2014 Susan S,im"
__license__ = "MIT License"
__status__ = "Prototype"
# imports one per line
import pytest
import os
from exercise2 import decide
DIR = "test_jsons/"
os.chdir(DIR)
def test_returning():
"""
Travellers are returning to KAN.
"""
assert decide("test_returning_citizen.json", "countries.json") ==\
["Accept", "Accept", "Quarantine"]
def test_basic():
assert decide("test_watchlist.json", "countries.json") == ["Quarantine"]
assert decide("test_quarantine.json", "countries.json") == ["Quarantine"]
assert decide("test_lowercase.json", "countries.json") == ["Accept"]
assert decide("test_raises_all_flags.json", "countries.json") == ["Quarantine"]
def test_empty():
assert decide("test_emptycountry.json", "countries.json") == ["Reject"]
assert decide("test_nopassport.json", "countries.json") == ["Reject"]
def test_wronginput():
assert decide("test_wrongpassport.json", "countries.json") == ["Reject"]
assert decide("test_wrongformat.json", "countries.json") == ["Quarantine"]
assert decide("test_nonexistent_country.json", "countries.json") == ["Reject"]
def test_wrongvisa():
assert decide("test_wrongvisa.json", "countries.json") == ["Quarantine"]
def test_compromised_citizen():
assert decide("test_returning_quarantine.json", "countries.json") == ["Quarantine"]
assert decide("test_returning_watchlisted.json", "countries.json") == ["Accept"]