forked from retoor/devplacepy
Split the monolithic test directory into three tiers (unit, api, e2e) with a path-mirroring directory structure. Added corresponding Makefile targets (test-unit, test-api, test-e2e) and updated all documentation references (CLAUDE.md, README.md, testing-cicd.html, testing-framework.html, testing-make.html) to reflect the new layout and naming conventions.
21 lines
694 B
Python
21 lines
694 B
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
from tests.conftest import BASE_URL, login_user
|
|
from devplacepy.database import get_table
|
|
def _promote_to_admin(username: str) -> None:
|
|
users = get_table("users")
|
|
user = users.find_one(username=username)
|
|
if user:
|
|
users.update({"uid": user["uid"], "role": "Admin"}, ["uid"])
|
|
|
|
|
|
def test_services_run_now(page, seeded_db):
|
|
user = seeded_db["alice"]
|
|
_promote_to_admin(user["username"])
|
|
login_user(page, user)
|
|
page.goto(f"{BASE_URL}/admin/services", wait_until="domcontentloaded")
|
|
resp = page.request.post(f"{BASE_URL}/admin/services/news/run")
|
|
assert resp.status == 200
|
|
data = resp.json()
|
|
assert data["ok"] is True
|