From 53e8dc40b451939e950135aa7ecfa156a0e2176b Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Tue, 19 Oct 2021 12:19:53 -0300 Subject: [PATCH] Adicionar teste POST pokemon duplicado --- api/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/tests.py b/api/tests.py index ec9209f..fc03a00 100755 --- a/api/tests.py +++ b/api/tests.py @@ -250,6 +250,16 @@ class MainTestCase(TestCase): self.assertIn(b"Dummy", 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): data = { "name": "Dummy",