MCPcopy Index your code
hub / github.com/PokeAPI/pokeapi / test_characteristic_api

Method test_characteristic_api

pokemon_v2/tests.py:4357–4394  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4355
4356 # Characteristic Tests
4357 def test_characteristic_api(self):
4358 characteristic = self.setup_characteristic_data(gene_mod_5=5)
4359 characteristic_description = self.setup_characteristic_description_data(
4360 characteristic, description="base char desc"
4361 )
4362
4363 response = self.client.get(
4364 "{}/characteristic/{}/".format(API_V2, characteristic.pk)
4365 )
4366
4367 self.assertEqual(response.status_code, status.HTTP_200_OK)
4368
4369 # base params
4370 self.assertEqual(response.data["id"], characteristic.pk)
4371 self.assertEqual(response.data["gene_modulo"], characteristic.gene_mod_5)
4372 # name params
4373 self.assertEqual(
4374 response.data["descriptions"][0]["description"],
4375 characteristic_description.description,
4376 )
4377 self.assertEqual(
4378 response.data["descriptions"][0]["language"]["name"],
4379 characteristic_description.language.name,
4380 )
4381 self.assertEqual(
4382 response.data["descriptions"][0]["language"]["url"],
4383 "{}{}/language/{}/".format(
4384 TEST_HOST, API_V2, characteristic_description.language.pk
4385 ),
4386 )
4387 # stat params
4388 self.assertEqual(
4389 response.data["highest_stat"]["name"], characteristic.stat.name
4390 )
4391 self.assertEqual(
4392 response.data["highest_stat"]["url"],
4393 "{}{}/stat/{}/".format(TEST_HOST, API_V2, characteristic.stat.pk),
4394 )
4395
4396 def test_characteristic_values(self):
4397 # check for all 5 possible values of gene_modulo

Callers

nothing calls this directly

Calls 3

getMethod · 0.80

Tested by

no test coverage detected