-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
45 lines (35 loc) · 1.06 KB
/
tests.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
import time
import pytest
from ai_presenter import CLI
import os
from client import Client
class TestPresenter:
@pytest.fixture(autouse=True)
def setup(self):
pass
@pytest.mark.asyncio
async def test_output_file_generates(self):
await CLI(["a.pptx"], 100)()
assert os.path.exists("a.json")
with open("a.json", "r") as file:
text = file.read()
assert text[0] == '[' and text[-1] == ']'
class TestWebAPI:
@pytest.fixture(autouse=True)
def setup(self):
pass
def test_web_api(self):
uid = Client.upload("a.pptx")
still = True
while still:
try:
status = Client.status(uid)
assert status.status == "Done"
assert status.filename == "a.pptx"
assert status.timestamp
assert status.explanation
still = False
except RuntimeError:
time.sleep(1)
if __name__ == "__main__":
pytest.main()