mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-14 15:57:07 +00:00
Add tests for Pokemon form types
This commit is contained in:
parent
98d67b19ed
commit
d983f29543
1 changed files with 20 additions and 0 deletions
|
@ -1608,6 +1608,16 @@ class APIData:
|
|||
|
||||
return pokemon_form_sprites
|
||||
|
||||
@classmethod
|
||||
def setup_pokemon_form_type_data(cls, pokemon_form, type=None, slot=1):
|
||||
|
||||
type = type or cls.setup_type_data(name="tp for pkmn frm")
|
||||
|
||||
form_type = PokemonFormType(pokemon_form=pokemon_form, type=type, slot=slot)
|
||||
form_type.save()
|
||||
|
||||
return form_type
|
||||
|
||||
@classmethod
|
||||
def setup_pokemon_form_data(
|
||||
cls,
|
||||
|
@ -4954,6 +4964,7 @@ class APITests(APIData, APITestCase):
|
|||
pokemon=pokemon, name="pkm form for base pkmn"
|
||||
)
|
||||
pokemon_form_sprites = self.setup_pokemon_form_sprites_data(pokemon_form)
|
||||
pokemon_form_type = self.setup_pokemon_form_type_data(pokemon_form)
|
||||
|
||||
sprites_data = json.loads(pokemon_form_sprites.sprites)
|
||||
|
||||
|
@ -4997,6 +5008,15 @@ class APITests(APIData, APITestCase):
|
|||
),
|
||||
)
|
||||
self.assertEqual(response.data["sprites"]["back_default"], None)
|
||||
# type params
|
||||
self.assertEqual(response.data["types"][0]["slot"], pokemon_form_type.slot)
|
||||
self.assertEqual(
|
||||
response.data["types"][0]["type"]["name"], pokemon_form_type.type.name
|
||||
)
|
||||
self.assertEqual(
|
||||
response.data["types"][0]["type"]["url"],
|
||||
"{}{}/type/{}/".format(TEST_HOST, API_V2, pokemon_form_type.type.pk),
|
||||
)
|
||||
|
||||
# Evolution test
|
||||
def test_evolution_trigger_api(self):
|
||||
|
|
Loading…
Reference in a new issue