()
| 88 | |
| 89 | |
| 90 | def test_get_difficult_cards(): |
| 91 | mock_session = MagicMock(spec=Session) |
| 92 | mock_collection_id = uuid.uuid4() |
| 93 | |
| 94 | mock_difficult_cards = [ |
| 95 | (uuid.uuid4(), "Difficult Card 1", 7, 2), |
| 96 | (uuid.uuid4(), "Difficult Card 2", 6, 2), |
| 97 | (uuid.uuid4(), "Difficult Card 3", 5, 1), |
| 98 | ] |
| 99 | |
| 100 | mock_exec = mock_session.exec.return_value |
| 101 | mock_exec.all.return_value = mock_difficult_cards |
| 102 | |
| 103 | result = _get_difficult_cards( |
| 104 | session=mock_session, collection_id=mock_collection_id |
| 105 | ) |
| 106 | |
| 107 | assert isinstance(result, list) |
| 108 | assert len(result) == len(mock_difficult_cards) |
| 109 | |
| 110 | for i, card_stat in enumerate(result): |
| 111 | assert card_stat.id == mock_difficult_cards[i][0] |
| 112 | assert card_stat.front == mock_difficult_cards[i][1] |
| 113 | assert card_stat.total_attempts == mock_difficult_cards[i][2] |
| 114 | assert card_stat.correct_answers == mock_difficult_cards[i][3] |
| 115 | |
| 116 | |
| 117 | def test_get_collection_stats(): |
nothing calls this directly
no test coverage detected