Fix #18: check for existing user on registration

This commit is contained in:
François Voron
2019-10-19 18:31:08 +02:00
parent a5618399a1
commit a4171f8bea
3 changed files with 14 additions and 1 deletions

View File

@ -76,9 +76,14 @@ class TestRegister:
response = test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
def test_valid_body(self, test_app_client: TestClient):
def test_existing_user(self, test_app_client: TestClient):
json = {"email": "king.arthur@camelot.bt", "password": "guinevere"}
response = test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_400_BAD_REQUEST
def test_valid_body(self, test_app_client: TestClient):
json = {"email": "lancelot@camelot.bt", "password": "guinevere"}
response = test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_200_OK
response_json = response.json()