feat(admin): Add group admin and test for admin views

This commit is contained in:
2026-01-03 10:39:52 +01:00
parent 927b4b0b4e
commit a6e97c6170
6 changed files with 352 additions and 14 deletions

View File

@@ -41,10 +41,23 @@ def get_test_session():
app.dependency_overrides[get_session] = get_test_session
class APSTestClient(TestClient):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def post(self, *args, user: str = "test", **kwargs):
with mock.patch.dict(os.environ, {"APS_username": user}, clear=False):
return super().post(*args, **kwargs)
def get(self, *args, user: str = "test", **kwargs):
with mock.patch.dict(os.environ, {"APS_username": user}, clear=False):
return super().get(*args, **kwargs)
@pytest.fixture(scope="session")
def client():
os.environ["APS_username"] = "test"
return TestClient(app)
return APSTestClient(app)
@pytest.fixture(scope="session")