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.models.user import User
|
||||
from app.tests.utils.utils import random_email
|
||||
|
||||
|
||||
def test_create_user(client: TestClient, db: Session) -> None:
|
||||
data = {
|
||||
"email": random_email(),
|
||||
"password": "password123",
|
||||
}
|
||||
|
||||
r = client.post(
|
||||
f"{settings.API_V1_STR}/private/users/",
|
||||
json={
|
||||
"email": "pollo@listo.com",
|
||||
"password": "password123",
|
||||
"full_name": "Pollo Listo",
|
||||
},
|
||||
json=data,
|
||||
)
|
||||
|
||||
assert r.status_code == status.HTTP_200_OK
|
||||
|
||||
data = r.json()
|
||||
|
||||
# TODO: Give user role
|
||||
|
||||
user = db.exec(select(User).where(User.id == data["id"])).first()
|
||||
|
||||
assert user
|
||||
assert user.email == "pollo@listo.com"
|
||||
assert user.full_name == "Pollo Listo"
|
||||
assert user.email == data["email"]
|
||||
|
||||
Reference in New Issue
Block a user