-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathtest_classify.py
More file actions
53 lines (45 loc) · 1.35 KB
/
test_classify.py
File metadata and controls
53 lines (45 loc) · 1.35 KB
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
import responses
from veryfi import Client
MOCK = {
"id": 12345,
"document_type": {
"score": 0.98,
"value": "receipt",
},
}
@responses.activate
def test_classify_document_url():
client = Client(client_id="v", client_secret="w", username="o", api_key="c")
responses.add(
responses.POST,
f"{client.versioned_url}/partner/classify/",
json=MOCK,
status=200,
)
d = client.classify_document_url(file_url="https://cdn.example.com/receipt.jpg")
assert d == MOCK
@responses.activate
def test_classify_document():
client = Client(client_id="v", client_secret="w", username="o", api_key="c")
responses.add(
responses.POST,
f"{client.versioned_url}/partner/classify/",
json=MOCK,
status=200,
)
d = client.classify_document(file_path="tests/assets/receipt_public.jpg")
assert d == MOCK
@responses.activate
def test_classify_document_url_with_document_types():
client = Client(client_id="v", client_secret="w", username="o", api_key="c")
responses.add(
responses.POST,
f"{client.versioned_url}/partner/classify/",
json=MOCK,
status=200,
)
d = client.classify_document_url(
file_url="https://cdn.example.com/receipt.jpg",
document_types=["receipt", "invoice", "check"],
)
assert d == MOCK