예제 #1
0
def test_activate_expired():
    expired_date = datetime.datetime.now() - datetime.timedelta(seconds=8000)
    user = User(is_active=False)
    user.activation_token_created_at = expired_date

    with pytest.raises(ActivationExpiredError):
        user.activate()
예제 #2
0
def test_activate():
    user = User(is_active=False)
    user.generate_activation()

    user.activate()

    assert user.is_active
    assert not user.activation_token
    assert not user.activation_token_created_at