(self)
| 5451 | |
| 5452 | # verifies that the wurmple evolution chain is serialized correctly |
| 5453 | def test_evolution_chain_api_wurmple_bugfix(self): |
| 5454 | # set up wurmple-like evolution chain |
| 5455 | evolution_chain = self.setup_evolution_chain_data() |
| 5456 | |
| 5457 | basic = self.setup_pokemon_species_data( |
| 5458 | name="wurmple", |
| 5459 | evolution_chain=evolution_chain, |
| 5460 | ) |
| 5461 | |
| 5462 | stage_one_first = self.setup_pokemon_species_data( |
| 5463 | name="silcoon", |
| 5464 | evolves_from_species=basic, |
| 5465 | evolution_chain=evolution_chain, |
| 5466 | ) |
| 5467 | stage_one_first_evolution = self.setup_pokemon_evolution_data( |
| 5468 | evolved_species=stage_one_first, min_level=7 |
| 5469 | ) |
| 5470 | |
| 5471 | stage_two_first = self.setup_pokemon_species_data( |
| 5472 | name="beautifly", |
| 5473 | evolves_from_species=stage_one_first, |
| 5474 | evolution_chain=evolution_chain, |
| 5475 | ) |
| 5476 | stage_two_first_evolution = self.setup_pokemon_evolution_data( |
| 5477 | evolved_species=stage_two_first, min_level=10 |
| 5478 | ) |
| 5479 | |
| 5480 | stage_one_second = self.setup_pokemon_species_data( |
| 5481 | name="cascoon", |
| 5482 | evolves_from_species=basic, |
| 5483 | evolution_chain=evolution_chain, |
| 5484 | ) |
| 5485 | stage_one_second_evolution = self.setup_pokemon_evolution_data( |
| 5486 | evolved_species=stage_one_second, min_level=7 |
| 5487 | ) |
| 5488 | |
| 5489 | stage_two_second = self.setup_pokemon_species_data( |
| 5490 | name="dustox", |
| 5491 | evolves_from_species=stage_one_second, |
| 5492 | evolution_chain=evolution_chain, |
| 5493 | ) |
| 5494 | stage_two_second_evolution = self.setup_pokemon_evolution_data( |
| 5495 | evolved_species=stage_two_second, min_level=10 |
| 5496 | ) |
| 5497 | |
| 5498 | response = self.client.get( |
| 5499 | "{}/evolution-chain/{}/".format(API_V2, evolution_chain.pk) |
| 5500 | ) |
| 5501 | |
| 5502 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
| 5503 | |
| 5504 | # base params |
| 5505 | self.assertEqual(response.data["id"], evolution_chain.pk) |
| 5506 | |
| 5507 | # assert tree has been serialized correctly |
| 5508 | basic_data = response.data["chain"] |
| 5509 | self.assertEqual(len(basic_data["evolves_to"]), 2) |
| 5510 |
nothing calls this directly
no test coverage detected