feat(admin): Add group admin and test for admin views
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user