35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
import unittest
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from math_problems_structure.server.app import app
|
|
|
|
|
|
class Grade1ServerTest(unittest.TestCase):
|
|
def test_join_pictures_with_quantity_route_uses_core_generator(self) -> None:
|
|
client = TestClient(app)
|
|
response = client.post(
|
|
"/grade-1/join-pictures-with-quantity",
|
|
json={
|
|
"available_pictures": [
|
|
{
|
|
"id": f"picture-{index}",
|
|
"name": f"Picture {index}",
|
|
"image_path": f"/images/{index}.png",
|
|
}
|
|
for index in range(10)
|
|
],
|
|
"seed": 1,
|
|
},
|
|
)
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
problem = response.json()
|
|
self.assertEqual(len(problem["left_containers"]), 5)
|
|
self.assertEqual(len(problem["number_cards"]), 5)
|
|
self.assertEqual(len(problem["right_containers"]), 5)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|