MCPcopy
hub / github.com/PokeAPI/pokeapi / test_item_attribute_api

Method test_item_attribute_api

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

Source from the content-addressed store, hash-verified

2498
2499 # Item Tests
2500 def test_item_attribute_api(self):
2501 # item attribute data
2502 item_attribute = self.setup_item_attribute_data(name="base itm attr")
2503 item_attribute_name = self.setup_item_attribute_name_data(
2504 item_attribute, name="base itm attr nm"
2505 )
2506 item_attribute_description = self.setup_item_attribute_description_data(
2507 item_attribute, description="base itm attr desc"
2508 )
2509 item = self.setup_item_data(name="itm fr base itm attr")
2510 self.setup_item_attribute_map_data(item_attribute=item_attribute, item=item)
2511
2512 response = self.client.get(
2513 "{}/item-attribute/{}/".format(API_V2, item_attribute.pk)
2514 )
2515
2516 # base params
2517 self.assertEqual(response.data["id"], item_attribute.pk)
2518 self.assertEqual(response.data["name"], item_attribute.name)
2519 # name params
2520 self.assertEqual(response.data["names"][0]["name"], item_attribute_name.name)
2521 self.assertEqual(
2522 response.data["names"][0]["language"]["name"],
2523 item_attribute_name.language.name,
2524 )
2525 self.assertEqual(
2526 response.data["names"][0]["language"]["url"],
2527 "{}{}/language/{}/".format(
2528 TEST_HOST, API_V2, item_attribute_name.language.pk
2529 ),
2530 )
2531 # description params
2532 self.assertEqual(
2533 response.data["descriptions"][0]["description"],
2534 item_attribute_description.description,
2535 )
2536 self.assertEqual(
2537 response.data["descriptions"][0]["language"]["name"],
2538 item_attribute_description.language.name,
2539 )
2540 self.assertEqual(
2541 response.data["descriptions"][0]["language"]["url"],
2542 "{}{}/language/{}/".format(
2543 TEST_HOST, API_V2, item_attribute_description.language.pk
2544 ),
2545 )
2546 # item params
2547 self.assertEqual(response.data["items"][0]["name"], item.name)
2548 self.assertEqual(
2549 response.data["items"][0]["url"],
2550 "{}{}/item/{}/".format(TEST_HOST, API_V2, item.pk),
2551 )
2552
2553 def test_item_category_api(self):
2554 # item category data

Callers

nothing calls this directly

Tested by

no test coverage detected