25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
from src.db import DbSession
|
|
from src.schemas import Session
|
|
from fastapi import FastAPI
|
|
from src.db import DbSession
|
|
from fastapi.testclient import TestClient
|
|
from src.users import UserCreate, User
|
|
from fastapi.encoders import jsonable_encoder
|
|
|
|
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
# Tests to write
|
|
# - User Flow: register, verify, login
|
|
# - create, list, delete session
|
|
# - friendship: query user by mail, create friend request, accept
|
|
def test_register_user(app: FastAPI, db_session: DbSession, client: TestClient):
|
|
req_data = jsonable_encoder(UserCreate(email="test@abc.com", password="password"))
|
|
response = client.post("/auth/register", json=req_data)
|
|
print(response.json())
|
|
resp_user = User(**response.json())
|
|
assert response.status_code == 201
|
|
assert resp_user.is_active
|
|
assert not resp_user.is_superuser
|
|
assert not resp_user.is_verified
|