-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_frontend.py
33 lines (22 loc) · 1.1 KB
/
test_frontend.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
#!/usr/bin/python3
import os
from genezio import genezio_deploy, genezio_login, genezio_delete
from utils import run_curl
def test_frontend():
print("Starting frontend test...")
token = os.environ.get('GENEZIO_TOKEN')
genezio_login(token)
os.chdir("./projects/mini-frontend/")
deploy_result = genezio_deploy(True)
assert deploy_result.return_code == 0, "genezio deploy --frontend returned non-zero exit code"
assert deploy_result.project_url != "", "genezio deploy --frontend returned empty project url"
assert "mnopqr-genezio-test-frontend" in deploy_result.project_url, "genezio deploy --frontend returned wrong project url"
status, output = run_curl(deploy_result.project_url)
assert status == 0, "`curl` returned non-zero exit code"
assert "Hello World" in output, "page " + deploy_result.project_url + " doesn't contain 'Hello World'"
print("Prepared to delete project...")
genezio_delete(deploy_result.project_id)
print("Test passed!")
# Test order matters because the commands are having side effects.
if __name__ == '__main__':
test_frontend()