Adicionar teste para DELETE /../pokemon/{id}
This commit is contained in:
parent
b883802eac
commit
f699917126
12
api/tests.py
12
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)
|
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__":
|
||||||
|
|
Loading…
Reference in New Issue