async def test_get_current_active_user(): user_data = { 'id': 1, 'username': '******', 'email': '*****@*****.**', 'password': '******', 'is_active': True } user = schemas.User(**user_data) active_user = await get_current_active_user(user) assert active_user is user
async def test_get_current_inactive_user(): user_data = { 'id': 1, 'username': '******', 'email': '*****@*****.**', 'password': '******', 'is_active': False } user = schemas.User(**user_data) try: exception = False await get_current_active_user(user) except HTTPException: exception = True assert exception, 'Must active user is returned'
def override_user(): return auth_schemas.User(id="1", username="******", email="foo1", password="******", is_active=True)