-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_api.py
39 lines (30 loc) · 1.26 KB
/
test_api.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
import pytest
import requests
import veriff as api
VALID_SESSION_TESTS = [
("Carlos Kidman", "en", "US", api.DocumentType.DRIVERS_LICENSE),
("张 Zhāng", "ch", "CH", api.DocumentType.PASSPORT),
("Nico", "bg", "BG", api.DocumentType.ID_CARD),
# ... add more examples including what we've documented in veriff.feature
]
@pytest.mark.parametrize("session", VALID_SESSION_TESTS)
def test_create_session(session):
token = api.create_session(*session)
assert token is not None and len(token) > 0
@pytest.mark.parametrize("session", VALID_SESSION_TESTS)
def test_get_session_config(session):
token = api.create_session(*session)
config = api.get_session_config(token)
assert config.get("status") == "created"
LOCALE_TESTS = [
("en", "Passport"),
("bg", "Паспорт"),
# more examples, but we could check the entire JSON object instead of a single field
]
@pytest.mark.parametrize("language, expected", LOCALE_TESTS)
@pytest.mark.skip(reason="Ask team how to get dynamic ID for locales")
def test_get_locales(language, expected):
dynamic_id = ""
response = requests.get(f"https://magic.saas-3.veriff.me/static/locales/{language}-{dynamic_id}.json")
json = response.json()
assert json.get("vrff.PASSPORT") == expected