Add unit test to check email validation

This commit is contained in:
François Voron
2020-07-20 11:25:50 +02:00
parent 1b6c832b28
commit 4273076831
2 changed files with 10 additions and 2 deletions

View File

@ -26,8 +26,8 @@ class User(models.BaseUser):
first_name: Optional[str]
class UserCreate(User, models.BaseUserCreate):
pass
class UserCreate(models.BaseUserCreate):
first_name: Optional[str]
class UserUpdate(User, models.BaseUserUpdate):

View File

@ -49,6 +49,14 @@ class TestRegister:
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert after_register.called is False
async def test_missing_email(
self, test_app_client: httpx.AsyncClient, after_register
):
json = {"password": "guinevere"}
response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert after_register.called is False
async def test_missing_password(
self, test_app_client: httpx.AsyncClient, after_register
):