Adicionar teste para DELETE /../pokemon/{id}

This commit is contained in:
Augusto Gunsch 2021-10-19 12:08:06 -03:00
parent b883802eac
commit f699917126
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 12 additions and 0 deletions

View File

@ -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) response = self.client.delete("/trainer/2/pokemon/{}".format(response.get_json()["id"]), headers={"Authorization":token}, follow_redirects=True)
self.assert_200(response) 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__": if __name__ == "__main__":