Create testing cards
(
client: TestClient,
normal_user_token_headers: dict[str, str],
test_collection: dict[str, Any],
)
| 46 | |
| 47 | @pytest.fixture |
| 48 | def test_multiple_cards( |
| 49 | client: TestClient, |
| 50 | normal_user_token_headers: dict[str, str], |
| 51 | test_collection: dict[str, Any], |
| 52 | ) -> list[dict[str, Any]]: |
| 53 | """Create testing cards""" |
| 54 | collection_id = test_collection["id"] |
| 55 | |
| 56 | cards = [] |
| 57 | for i in range(5): |
| 58 | card_data = CardCreate(front=f"Test front {i}", back=f"Test back {i}") |
| 59 | rsp = client.post( |
| 60 | f"{settings.API_V1_STR}/collections/{collection_id}/cards/", |
| 61 | json=card_data.model_dump(), |
| 62 | headers=normal_user_token_headers, |
| 63 | ) |
| 64 | |
| 65 | assert rsp.status_code == 200 |
| 66 | cards.append(rsp.json()) |
| 67 | return cards |
| 68 | |
| 69 | |
| 70 | def test_create_card_with_nonexistent_collection( |