From c737368f41a2899b5b76726094f1379fc31096a7 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:12:12 +0000 Subject: [PATCH] disable endpoint until we find whether it is used or not --- src/endpoints/url.py | 14 +++++++------- src/tests/endpoints/test_url.py | 27 ++++++++++++++------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/endpoints/url.py b/src/endpoints/url.py index f8e7154..58cf3c4 100644 --- a/src/endpoints/url.py +++ b/src/endpoints/url.py @@ -56,13 +56,13 @@ def search_by_url( def latest(skip: int = 0, limit: int = 25, db: Session = Depends(get_db_dependency), email=Depends(get_user_auth)) -> list[schemas.ArchiveResult]: return crud.search_archives_by_email(db, email, skip=skip, limit=limit) - -@url_router.get("/{id}", summary="Fetch a single URL archive by the associated id.") -def lookup(id, db: Session = Depends(get_db_dependency), email=Depends(get_token_or_user_auth)) -> schemas.ArchiveResult: - archive = crud.get_archive(db, id, email) - if archive is None: - raise HTTPException(status_code=404, detail="Archive not found") - return archive +# TODO: find out where/if this is used, tests are also disabled +# @url_router.get("/{id}", summary="Fetch a single URL archive by the associated id.") +# def lookup(id, db: Session = Depends(get_db_dependency), email=Depends(get_token_or_user_auth)) -> schemas.ArchiveResult: +# archive = crud.get_archive(db, id, email) +# if archive is None: +# raise HTTPException(status_code=404, detail="Archive not found") +# return archive @url_router.delete("/{id}", summary="Delete a single URL archive by id.") diff --git a/src/tests/endpoints/test_url.py b/src/tests/endpoints/test_url.py index 8b0f549..5cccbf2 100644 --- a/src/tests/endpoints/test_url.py +++ b/src/tests/endpoints/test_url.py @@ -122,21 +122,22 @@ def test_lookup_unauthenticated(client, test_no_auth): test_no_auth(client.get, "/url/123-456-789") -def test_lookup(client_with_auth, db_session): - response = client_with_auth.get("/url/lookup-123-456-789") - assert response.status_code == 404 - assert response.json() == {"detail": "Archive not found"} +# # TODO: find out where/if this is used, tests are also disabled +# def test_lookup(client_with_auth, db_session): +# response = client_with_auth.get("/url/lookup-123-456-789") +# assert response.status_code == 404 +# assert response.json() == {"detail": "Archive not found"} - from db import crud, schemas - crud.create_task(db_session, ArchiveCreate(id="lookup-123-456-789", url="https://example.com", result={}, public=True, author_id="rick@example.com", group_id=None), [], []) +# from db import crud, schemas +# crud.create_task(db_session, ArchiveCreate(id="lookup-123-456-789", url="https://example.com", result={}, public=True, author_id="rick@example.com", group_id=None), [], []) - response = client_with_auth.get("/url/lookup-123-456-789") - assert response.status_code == 200 - j = response.json() - assert j.keys() == schemas.ArchiveResult.model_fields.keys() - assert j["id"] == "lookup-123-456-789" - assert j["url"] == "https://example.com" - assert j["result"] == {} +# response = client_with_auth.get("/url/lookup-123-456-789") +# assert response.status_code == 200 +# j = response.json() +# assert j.keys() == schemas.ArchiveResult.model_fields.keys() +# assert j["id"] == "lookup-123-456-789" +# assert j["url"] == "https://example.com" +# assert j["result"] == {} def test_delete_task_unauthenticated(client, test_no_auth):