Make private test email random
This commit is contained in:
@@ -4,26 +4,25 @@ from sqlmodel import Session, select
|
|||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.models.user import User
|
from app.models.user import User
|
||||||
|
from app.tests.utils.utils import random_email
|
||||||
|
|
||||||
|
|
||||||
def test_create_user(client: TestClient, db: Session) -> None:
|
def test_create_user(client: TestClient, db: Session) -> None:
|
||||||
|
data = {
|
||||||
|
"email": random_email(),
|
||||||
|
"password": "password123",
|
||||||
|
}
|
||||||
|
|
||||||
r = client.post(
|
r = client.post(
|
||||||
f"{settings.API_V1_STR}/private/users/",
|
f"{settings.API_V1_STR}/private/users/",
|
||||||
json={
|
json=data,
|
||||||
"email": "pollo@listo.com",
|
|
||||||
"password": "password123",
|
|
||||||
"full_name": "Pollo Listo",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert r.status_code == status.HTTP_200_OK
|
assert r.status_code == status.HTTP_200_OK
|
||||||
|
|
||||||
data = r.json()
|
data = r.json()
|
||||||
|
|
||||||
# TODO: Give user role
|
|
||||||
|
|
||||||
user = db.exec(select(User).where(User.id == data["id"])).first()
|
user = db.exec(select(User).where(User.id == data["id"])).first()
|
||||||
|
|
||||||
assert user
|
assert user
|
||||||
assert user.email == "pollo@listo.com"
|
assert user.email == data["email"]
|
||||||
assert user.full_name == "Pollo Listo"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user