✨ Add email validation (#40)

* modify tests

* ➕ Add email-validator to Dockerfiles

* ♻️ Update random email generation

* ♻️ Re-apply email validation after rebase

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Teomor Szczurek
2020-04-06 11:36:29 +02:00
committed by GitHub
parent 1d8678235d
commit 970a182ec8
8 changed files with 28 additions and 25 deletions
@@ -4,7 +4,7 @@ from app import crud
from app.core import config
from app.db.session import db_session
from app.schemas.user import UserCreate, UserUpdate
from app.tests.utils.utils import get_server_api, random_lower_string
from app.tests.utils.utils import get_server_api, random_lower_string, random_email
def user_authentication_headers(server_api, email, password):
@@ -18,7 +18,7 @@ def user_authentication_headers(server_api, email, password):
def create_random_user():
email = random_lower_string()
email = random_email()
password = random_lower_string()
user_in = UserCreate(username=email, email=email, password=password)
user = crud.user.create(db_session=db_session, obj_in=user_in)
@@ -2,7 +2,6 @@ import random
import string
import requests
from app.core import config
@@ -10,6 +9,10 @@ def random_lower_string():
return "".join(random.choices(string.ascii_lowercase, k=32))
def random_email():
return f"{random_lower_string()}@{random_lower_string()}.com"
def get_server_api():
server_name = f"http://{config.SERVER_NAME}"
return server_name