drops /groups endpoint, no longer used

This commit is contained in:
msramalho
2025-02-04 14:05:59 +00:00
parent 1e872e8225
commit 8bd7e5e590
2 changed files with 4 additions and 31 deletions

View File

@@ -40,13 +40,8 @@ async def active(
return {"active": user.active}
@default_router.get("/groups", deprecated=True) # DEPRECATED, only used by extension
def get_user_groups(email=Depends(get_user_auth)) -> list[str]:
return crud.get_user_groups(email)
@default_router.get("/permissions")
def get_user_groups(
def get_user_permissions(
user: UserState = Depends(get_user_state),
) -> Dict[str, GroupPermissions]:
return user.permissions

View File

@@ -5,7 +5,6 @@ from core.config import VERSION
from tests.db.test_crud import test_data
def test_endpoint_home(client_with_auth):
r = client_with_auth.get("/")
assert r.status_code == 200
@@ -55,6 +54,7 @@ def test_endpoint_active_true_user(client_with_auth):
assert r.status_code == 200
assert r.json() == {"active": True}
def test_endpoint_active_false_user(app):
from web.security import get_user_auth
@@ -66,30 +66,6 @@ def test_endpoint_active_false_user(app):
assert r.json() == {"active": False}
def test_endpoint_groups_no_auth(client, test_no_auth):
test_no_auth(client.get, "/groups")
def test_endpoint_groups_rick_and_morty(client_with_auth):
r = client_with_auth.get("/groups")
assert r.status_code == 200
assert len(j := r.json()) == 2
assert 'animated-characters' in j
assert 'spaceship' in j
@patch("endpoints.default.crud.get_user_groups", return_value=["group1", "group2"])
def test_endpoint_groups(m1, app):
from web.security import get_user_auth
app.dependency_overrides[get_user_auth] = lambda: True
client = TestClient(app)
r = client.get("/groups")
assert r.status_code == 200
assert r.json() == ["group1", "group2"]
def test_no_serve_local_archive_by_default(client_with_auth):
r = client_with_auth.get("/app/local_archive_test/temp.txt")
assert r.status_code == 404
@@ -104,9 +80,11 @@ def test_favicon(client_with_auth):
def test_endpoint_test_prometheus_no_auth(client, test_no_auth):
test_no_auth(client.get, "/metrics")
def test_endpoint_test_prometheus_no_user_auth(client_with_auth, test_no_auth):
test_no_auth(client_with_auth.get, "/metrics")
@pytest.mark.asyncio
async def test_prometheus_metrics(test_data, client_with_token, get_settings):
# before metrics calculation