flask-demo-api/tests/test_get.py

15 lines
418 B
Python
Raw Normal View History

2024-04-16 01:03:02 +03:00
def test_get_without_args(client):
response = client.get("/")
assert response.status_code == 400
assert response.get_json() == {
"error": "400 Bad Request: Invalid GET parameters",
}
def test_get_with_wrong_key(client):
response = client.get("/?key=blabla")
assert response.status_code == 404
assert response.get_json() == {
"error": "404 Not Found: Key not found",
}