File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,28 @@ async def test_get_age_rating_list(
2828 assert response .status_code == status .HTTP_200_OK , response .text
2929 response_data = response .json ()
3030 assert "data" in response_data , response_data
31+ expected_data = {
32+ "data" : [
33+ {
34+ "id" : age_rating_g .name ,
35+ "attributes" : AgeRatingAttributesSchema .model_validate (age_rating_g ).model_dump (),
36+ "type" : "age-rating" ,
37+ },
38+ ],
39+ "meta" : {
40+ # we expect that db was empty before the test.
41+ # the only age rating obj was created in a fixture.
42+ "count" : 1 ,
43+ "totalPages" : 1 ,
44+ },
45+ "jsonapi" : {"version" : "1.0" },
46+ }
47+ assert response_data == expected_data
48+ # checks that all the ids are the names
3149 entities : list [dict [str , Any ]] = response_data ["data" ]
3250 for entity in entities :
3351 assert entity ["id" ] == entity ["attributes" ]["name" ]
3452
35- rating_g_data = next (
36- filter (lambda e : e ["id" ] == age_rating_g .name , entities ),
37- )
38- expected_rating_g_data = AgeRatingAttributesSchema .model_validate (age_rating_g ).model_dump ()
39- assert rating_g_data ["attributes" ] == expected_rating_g_data
40-
4153
4254async def test_create_with_related_age_rating (
4355 app : FastAPI ,
You can’t perform that action at this time.
0 commit comments