Skip to content

Commit c05660e

Browse files
committed
chore(test): reorganize tests, add app.py and status version coverage
1 parent d04f9a1 commit c05660e

7 files changed

Lines changed: 77 additions & 17 deletions

File tree

tests/unit/test_zf_api_records.py renamed to tests/functional/api/test_zf_api_records.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pylint: disable=missing-class-docstring
21
def test_zf_api_record_get(client_single_zone, zfzone_common_data):
32
origin = zfzone_common_data.origin.to_text()
43
zone_endpoint = f"/api/zones/{origin}/records"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
def test_zf_api_status(client_new):
2+
"""
3+
GIVEN a web client for a newly initialized server
4+
WHEN the server status is requested
5+
THEN returns an HTML page with 200
6+
"""
7+
res = client_new.get("/api/status")
8+
assert res.status_code == 200
9+
assert res.json["running"] is True
10+
11+
12+
def test_zf_api_version(client_new):
13+
"""
14+
GIVEN a web client for a newly initialized server
15+
WHEN the server version is requested
16+
THEN returns a version string
17+
"""
18+
res = client_new.get("/api/status/version")
19+
assert res.status_code == 200
20+
assert res.json["version"] is not None
21+
assert isinstance(res.json["version"], str)
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
# pylint: disable=missing-class-docstring
21
def test_zf_api_recordtype_get_all(client_new):
2+
"""
3+
GIVEN a web client for a newly initialized server
4+
WHEN record data type information is requested
5+
THEN a list of record data type dicts is returned
6+
"""
37
res = client_new.get("/api/types/recordtype")
48
assert res.status_code == 200
59
res_body = res.json
@@ -10,6 +14,11 @@ def test_zf_api_recordtype_get_all(client_new):
1014

1115

1216
def test_zf_api_recordtype_get_single(client_new):
17+
"""
18+
GIVEN a web client for a newly initialized server
19+
WHEN the server status is requested
20+
THEN a single record data type dict is returned
21+
"""
1322
res = client_new.get("/api/types/recordtype/CNAME")
1423
assert res.status_code == 200
1524
res_body = res.json
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pylint: disable=missing-class-docstring
21
def test_zf_api_zone_get_empty(client_new):
32
res = client_new.get("/api/zones")
43
assert res.status_code == 200

tests/functional/test_app.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
def test_zf_app_home(client_new):
2+
"""
3+
GIVEN a web client for a newly initialized server
4+
WHEN the home page is requested
5+
THEN returns an HTML page with 200
6+
"""
7+
res = client_new.get("/")
8+
assert res.status_code == 200
9+
assert "text/html" in res.headers.get("Content-Type")
10+
assert "html" in res.text
11+
12+
13+
def test_zf_app_zone(client_single_zone):
14+
"""
15+
GIVEN a web client for a newly initialized server
16+
WHEN a zome's page is requested
17+
THEN returns an HTML page with 200
18+
"""
19+
res = client_single_zone.get("/zone/example.com.")
20+
assert res.status_code == 200
21+
assert "text/html" in res.headers.get("Content-Type")
22+
assert "html" in res.text
23+
24+
25+
def test_zf_app_login(client_new):
26+
"""
27+
GIVEN a web client for a newly initialized server
28+
WHEN the login page is requested
29+
THEN returns an HTML page with 200
30+
"""
31+
res = client_new.get("/login")
32+
assert res.status_code == 200
33+
assert "text/html" in res.headers.get("Content-Type")
34+
assert "html" in res.text
35+
36+
37+
def test_zf_app_signup(client_new):
38+
"""
39+
GIVEN a web client for a newly initialized server
40+
WHEN the signup page is requested
41+
THEN returns an HTML page with 200
42+
"""
43+
res = client_new.get("/signup")
44+
assert res.status_code == 200
45+
assert "text/html" in res.headers.get("Content-Type")
46+
assert "html" in res.text
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pylint: disable=missing-class-docstring
21
import os.path
32
import dns.rdatatype
43
import dns.zone

tests/unit/test_zf_api_status.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)