-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main.py
32 lines (22 loc) · 861 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 json
from werkzeug.wrappers import response
from urlshort.app import create_app
def test_shorten(client):
response = client.get('/')
assert response.status_code == 200
assert b'URL Shortener' in response.data
def test_redirect_to_url(client):
response = client.get('/aBc')
assert response.status_code == 404
def test_get_your_url(client):
response = client.get('/your-url')
assert response.status_code == 302
assert b'You should be redirected automatically to target URL' in response.data
def test_api(client):
response = client.get('/api')
assert response.status_code == 200
assert b'[]\n' in response.data
def test_healthz(client):
response = client.get('/_status/healthz')
assert response.status_code == 200
assert b'{"status":"OK"}\n' == response.data