Add user feature permissions and unified account management
This commit is contained in:
@@ -177,7 +177,7 @@ class InsightsRouteTests(unittest.TestCase):
|
||||
app = FastAPI()
|
||||
app.include_router(router.router)
|
||||
if authenticated:
|
||||
app.dependency_overrides[router.get_current_user] = lambda: USER
|
||||
app.dependency_overrides[router.get_current_user] = lambda: {**USER, "features": {"stats": True}}
|
||||
return TestClient(app)
|
||||
|
||||
def test_requires_authentication(self):
|
||||
@@ -190,7 +190,7 @@ class InsightsRouteTests(unittest.TestCase):
|
||||
response = client.get(f"/insights?days={days}")
|
||||
self.assertEqual(response.status_code, 200, response.text)
|
||||
self.assertEqual(response.headers["cache-control"], "no-store")
|
||||
report.assert_awaited_with(USER, 365)
|
||||
report.assert_awaited_with({**USER, "features": {"stats": True}}, 365)
|
||||
for query in ["days=-1", "days=999999", "days=invalid", "userid=other", "user_id=other", "scope=server"]:
|
||||
self.assertEqual(client.get(f"/insights?{query}").status_code, 422, query)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user