Adicionar teste POST pokemon duplicado
This commit is contained in:
parent
27a40f28a7
commit
53e8dc40b4
10
api/tests.py
10
api/tests.py
|
@ -250,6 +250,16 @@ class MainTestCase(TestCase):
|
||||||
self.assertIn(b"Dummy", response.data)
|
self.assertIn(b"Dummy", response.data)
|
||||||
self.assertIn(b"pokemon_data", response.data)
|
self.assertIn(b"pokemon_data", response.data)
|
||||||
|
|
||||||
|
def test_post_pokemon_duplicate(self):
|
||||||
|
data = {
|
||||||
|
"name": "Poltergeist",
|
||||||
|
"level": 2,
|
||||||
|
"pokemon_id": 12
|
||||||
|
}
|
||||||
|
self.client.post("/trainer/2/pokemon", json=data, headers={"Authorization":self.token_joao}, follow_redirects=True)
|
||||||
|
response = self.client.post("/trainer/2/pokemon", json=data, headers={"Authorization":self.token_joao}, follow_redirects=True)
|
||||||
|
self.assert_status(response, 409)
|
||||||
|
|
||||||
def test_post_pokemon_trainer_not_found(self):
|
def test_post_pokemon_trainer_not_found(self):
|
||||||
data = {
|
data = {
|
||||||
"name": "Dummy",
|
"name": "Dummy",
|
||||||
|
|
Loading…
Reference in New Issue