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()
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