Example #1
0
async def test_get_email_confirmation_status(user: User, email: str,
                                             confirmed: bool):
    auth_service = AuthService()
    auth_service._user = user
    status = await auth_service.get_email_confirmation_status()
    assert status.get("email") == email
    assert status.get("confirmed") == confirmed

    auth_service._user = user
    status = await auth_service.get_email_confirmation_status()
    assert status.get("email") == email
    assert status.get("confirmed") is confirmed
Example #2
0
async def test_request_email_confirmation_confirmed():
    auth_service = AuthService()
    auth_service._user = User(2, "user", False)
    with pytest.raises(HTTPException) as e:
        await auth_service.request_email_confirmation()

    assert e.type is HTTPException
    assert e.value.args[0] == 400
Example #3
0
async def test_request_email_confirmation():
    auth_service = AuthService()
    auth_service._user = User(3, "anotheruser", False)
    res = await auth_service.request_email_confirmation()
    assert res is None