From f699917126a47c7e1edd44749bc49191d767d5a7 Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Tue, 19 Oct 2021 12:08:06 -0300 Subject: [PATCH] Adicionar teste para DELETE /../pokemon/{id} --- api/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/tests.py b/api/tests.py index 267ea79..9260549 100755 --- a/api/tests.py +++ b/api/tests.py @@ -354,6 +354,18 @@ class MainTestCase(TestCase): response = self.client.delete("/trainer/2/pokemon/{}".format(response.get_json()["id"]), headers={"Authorization":token}, follow_redirects=True) self.assert_200(response) + # deletando pokemon de outro trainer + def test_delete_pokemon_forbidden(self): + login = { + "email": "joaooliveira@hotmail.com", + "password": "senha", + } + auth = self.client.post("/trainer/authenticate", json=login, follow_redirects=True) + self.assert_200(auth) + token = auth.get_json()["token"] + response = self.client.delete("/trainer/1/pokemon/1", headers={"Authorization":token}, follow_redirects=True) + self.assert_403(response) + if __name__ == "__main__":