fix: remove fief out of the source code (#502)

* fix: remove fief out of the source code

* fix: remove corresponding test about migration
This commit is contained in:
2025-07-21 21:09:05 -06:00
committed by GitHub
parent ad44492cae
commit 2a2af5fff2
10 changed files with 7 additions and 214 deletions

View File

@@ -1,6 +1,6 @@
import pytest
from unittest.mock import patch
from contextlib import asynccontextmanager
import pytest
from httpx import AsyncClient
@@ -261,67 +261,3 @@ async def test_transcript_mark_reviewed():
response = await ac.get(f"/transcripts/{tid}")
assert response.status_code == 200
assert response.json()["reviewed"] is True
@asynccontextmanager
async def patch_migrate_user():
with patch(
"reflector.db.migrate_user.users_to_migrate",
[["test@mail.com", "randomuserid", None]],
):
yield
@pytest.mark.asyncio
async def test_transcripts_list_authenticated_migration():
# XXX this test is a bit fragile, as it depends on the storage which
# is shared between tests
from reflector.app import app
testx1 = "testmigration1"
testx2 = "testmigration2"
async with patch_migrate_user(), AsyncClient(
app=app, base_url="http://test/v1"
) as ac:
# first ensure client 2 does not have any transcripts related to this test
async with authenticated_client2_ctx():
response = await ac.get("/transcripts")
assert response.status_code == 200
# assert len(response.json()["items"]) == 0
names = [t["name"] for t in response.json()["items"]]
assert testx1 not in names
assert testx2 not in names
# create 2 transcripts with client 1
async with authenticated_client_ctx():
response = await ac.post("/transcripts", json={"name": testx1})
assert response.status_code == 200
assert response.json()["name"] == testx1
response = await ac.post("/transcripts", json={"name": testx2})
assert response.status_code == 200
assert response.json()["name"] == testx2
response = await ac.get("/transcripts")
assert response.status_code == 200
assert len(response.json()["items"]) >= 2
names = [t["name"] for t in response.json()["items"]]
assert testx1 in names
assert testx2 in names
# now going back to client 2, migration should happen
async with authenticated_client2_ctx():
response = await ac.get("/transcripts")
assert response.status_code == 200
names = [t["name"] for t in response.json()["items"]]
assert testx1 in names
assert testx2 in names
# and client 1 should have nothing now
async with authenticated_client_ctx():
response = await ac.get("/transcripts")
assert response.status_code == 200
names = [t["name"] for t in response.json()["items"]]
assert testx1 not in names
assert testx2 not in names