swimtracker-app/backend/tests/test_session_api.py

25 lines
1.0 KiB
Python
Raw Normal View History

2021-08-29 17:57:25 +02:00
from src.db import DbSession
2021-08-29 16:01:32 +02:00
from src.schemas import Session
from fastapi import FastAPI
from src.db import DbSession
from fastapi.testclient import TestClient
2021-08-29 17:57:25 +02:00
from src.users import UserCreate, User
from fastapi.encoders import jsonable_encoder
2021-08-29 16:01:32 +02:00
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2021-08-29 17:57:25 +02:00
# 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