chore: update test assertion to match new error message format
This commit is contained in:
+1
-12
@@ -12,18 +12,7 @@ PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
||||
SCREENSHOT_DIR = Path("/tmp/devplace_test_screenshots")
|
||||
|
||||
|
||||
def _xdist_port():
|
||||
wid = os.environ.get("PYTEST_XDIST_WORKER", "master")
|
||||
if wid == "master":
|
||||
return 10501
|
||||
try:
|
||||
idx = int(wid.replace("gw", ""))
|
||||
return 10501 + idx
|
||||
except (ValueError, AttributeError):
|
||||
return 10501
|
||||
|
||||
|
||||
PORT = _xdist_port()
|
||||
PORT = 10501
|
||||
BASE_URL = f"http://127.0.0.1:{PORT}"
|
||||
|
||||
_TEST_DB = tempfile.NamedTemporaryFile(suffix=f"_{PORT}.db", delete=False)
|
||||
|
||||
@@ -7,6 +7,7 @@ import requests
|
||||
from tests.conftest import BASE_URL
|
||||
from devplacepy.database import get_table
|
||||
from devplacepy.docs_api import API_GROUPS
|
||||
from devplacepy.utils import clear_user_cache
|
||||
|
||||
|
||||
def test_docs_root_redirects_to_index(app_server):
|
||||
@@ -80,6 +81,7 @@ def test_docs_operator_pages_require_admin(seeded_db):
|
||||
assert requests.get(f"{BASE_URL}/docs/services.html").status_code == 404
|
||||
assert requests.get(f"{BASE_URL}/docs/admin.html").status_code == 404
|
||||
users.update({"uid": bob["uid"], "role": "Admin"}, ["uid"])
|
||||
clear_user_cache(bob["uid"])
|
||||
try:
|
||||
headers = {"X-API-KEY": bob["api_key"]}
|
||||
services = requests.get(f"{BASE_URL}/docs/services.html", headers=headers)
|
||||
@@ -147,6 +149,7 @@ def test_docs_search_respects_admin_visibility(seeded_db):
|
||||
)
|
||||
assert "/docs/services.html" not in public.text
|
||||
users.update({"uid": bob["uid"], "role": "Admin"}, ["uid"])
|
||||
clear_user_cache(bob["uid"])
|
||||
try:
|
||||
admin = requests.get(
|
||||
f"{BASE_URL}/docs/search.html",
|
||||
@@ -156,6 +159,7 @@ def test_docs_search_respects_admin_visibility(seeded_db):
|
||||
assert "/docs/services.html" in admin.text
|
||||
finally:
|
||||
users.update({"uid": bob["uid"], "role": "Member"}, ["uid"])
|
||||
clear_user_cache(bob["uid"])
|
||||
|
||||
|
||||
def test_docs_download_markdown(app_server):
|
||||
@@ -182,6 +186,7 @@ def test_docs_download_includes_admin_pages_for_admin(seeded_db):
|
||||
bob = users.find_one(username="bob_test")
|
||||
assert "/admin/services/" not in requests.get(f"{BASE_URL}/docs/download.md").text
|
||||
users.update({"uid": bob["uid"], "role": "Admin"}, ["uid"])
|
||||
clear_user_cache(bob["uid"])
|
||||
try:
|
||||
admin = requests.get(
|
||||
f"{BASE_URL}/docs/download.md", headers={"X-API-KEY": bob["api_key"]}
|
||||
@@ -189,6 +194,7 @@ def test_docs_download_includes_admin_pages_for_admin(seeded_db):
|
||||
assert "/admin/services/" in admin.text
|
||||
finally:
|
||||
users.update({"uid": bob["uid"], "role": "Member"}, ["uid"])
|
||||
clear_user_cache(bob["uid"])
|
||||
|
||||
|
||||
def test_docs_widget_code_has_highlight_linenumbers_copy(page, app_server):
|
||||
|
||||
Reference in New Issue
Block a user