(self)
| 3002 | |
| 3003 | # Location Tests |
| 3004 | def test_location_api(self): |
| 3005 | location = self.setup_location_data(name="base lctn") |
| 3006 | location_name = self.setup_location_name_data(location, name="base lctn name") |
| 3007 | location_game_index = self.setup_location_game_index_data( |
| 3008 | location, game_index=10 |
| 3009 | ) |
| 3010 | |
| 3011 | response = self.client.get("{}/location/{}/".format(API_V2, location.pk)) |
| 3012 | |
| 3013 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
| 3014 | |
| 3015 | # base params |
| 3016 | self.assertEqual(response.data["id"], location.pk) |
| 3017 | self.assertEqual(response.data["name"], location.name) |
| 3018 | # name params |
| 3019 | self.assertEqual(response.data["names"][0]["name"], location_name.name) |
| 3020 | self.assertEqual( |
| 3021 | response.data["names"][0]["language"]["name"], location_name.language.name |
| 3022 | ) |
| 3023 | self.assertEqual( |
| 3024 | response.data["names"][0]["language"]["url"], |
| 3025 | "{}{}/language/{}/".format(TEST_HOST, API_V2, location_name.language.pk), |
| 3026 | ) |
| 3027 | # region params |
| 3028 | self.assertEqual(response.data["region"]["name"], location.region.name) |
| 3029 | self.assertEqual( |
| 3030 | response.data["region"]["url"], |
| 3031 | "{}{}/region/{}/".format(TEST_HOST, API_V2, location.region.pk), |
| 3032 | ) |
| 3033 | # game indices params |
| 3034 | self.assertEqual( |
| 3035 | response.data["game_indices"][0]["game_index"], |
| 3036 | location_game_index.game_index, |
| 3037 | ) |
| 3038 | self.assertEqual( |
| 3039 | response.data["game_indices"][0]["generation"]["name"], |
| 3040 | location_game_index.generation.name, |
| 3041 | ) |
| 3042 | self.assertEqual( |
| 3043 | response.data["game_indices"][0]["generation"]["url"], |
| 3044 | "{}{}/generation/{}/".format( |
| 3045 | TEST_HOST, API_V2, location_game_index.generation.pk |
| 3046 | ), |
| 3047 | ) |
| 3048 | |
| 3049 | def test_location_area_api(self): |
| 3050 | location = self.setup_location_data(name="lctn for base lctn area") |
nothing calls this directly
no test coverage detected