MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / test_collection

Function test_collection

backend/tests/flashcards/practice_session/test_api.py:20–43  ·  view source on GitHub ↗

Create a testing collection

(
    client: TestClient, normal_user_token_headers: dict[str, str]
)

Source from the content-addressed store, hash-verified

18
19@pytest.fixture
20def test_collection(
21 client: TestClient, normal_user_token_headers: dict[str, str]
22) -> dict[str, Any]:
23 """Create a testing collection"""
24 collection_data = CollectionCreate(name="Test Collection")
25 rsp = client.post(
26 f"{settings.API_V1_STR}/collections/",
27 json=collection_data.model_dump(),
28 headers=normal_user_token_headers,
29 )
30 assert rsp.status_code == 200
31 collection = rsp.json()
32
33 card_count = 3
34 for i in range(card_count):
35 card_data = CardCreate(front=f"Test front {i}", back=f"Test back {i}")
36 rsp = client.post(
37 f"{settings.API_V1_STR}/collections/{collection['id']}/cards",
38 json=card_data.model_dump(),
39 headers=normal_user_token_headers,
40 )
41 assert rsp.status_code == 200
42
43 return collection
44
45
46@pytest.fixture

Callers

nothing calls this directly

Calls 2

CollectionCreateClass · 0.90
CardCreateClass · 0.90

Tested by

no test coverage detected