Files
devplacepy/tests/api/admin/issues/planning_page.py
T

34 lines
1.0 KiB
Python
Raw Normal View History

# retoor <retoor@molodetz.nl>
import requests
from tests.conftest import BASE_URL
from devplacepy.database import get_table, refresh_snapshot
JSON = {"Accept": "application/json"}
HTML = {"Accept": "text/html"}
def _admin(seeded_db):
refresh_snapshot()
key = get_table("users").find_one(username="alice_test")["api_key"]
session = requests.Session()
session.headers.update({"X-API-KEY": key})
return session
def test_planning_page_json_face(seeded_db):
r = _admin(seeded_db).get(f"{BASE_URL}/admin/issues/planning", headers=JSON)
assert r.status_code == 200, r.text[:300]
body = r.json()
assert "configured" in body
assert isinstance(body["tickets"], list)
def test_planning_page_uses_the_admin_vocabulary(seeded_db):
r = _admin(seeded_db).get(f"{BASE_URL}/admin/issues/planning", headers=HTML)
assert r.status_code == 200
assert "<h1" not in r.text.split('class="admin-content"', 1)[1]
assert "empty-state" not in r.text
assert "admin-header" not in r.text
assert 'aria-current="page"' in r.text