-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_main.py
32 lines (24 loc) · 896 Bytes
/
test_main.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
import pytest
from main import app
from sanic_testing.testing import SanicTestClient
test_client = SanicTestClient(app)
def test_get_root():
_, response = test_client.get("/")
assert response.json == {
"statusText": "Root Endpoint of BG-Remove-API",
}
assert response.status_code == 200
@pytest.mark.parametrize("mode", ["remove", "replace"])
def test_get_processing(mode: str):
_, response = test_client.get(f"/{mode}")
assert response.json == {
"statusText": f"{mode.title()} endpoint of BG-Remove-API",
}
assert response.status_code == 200
@pytest.mark.parametrize("mode", ["remove", "replace"])
def test_get_processing_li(mode: str):
_, response = test_client.get(f"/{mode}/li")
assert response.json == {
"statusText": f"{mode.title()} lightweight endpoint of BG-Remove-API",
}
assert response.status_code == 200