Esempio n. 1
0
    def test_used_token_is_not_valid(self, user, db):
        # Newly generated token is valid
        token = UserPasswordToken(user=user).save(db.session)
        assert token.invalid is False

        # Used token is not valid
        token.update(used=True)
        assert token.invalid is True
Esempio n. 2
0
    def test_expired_token_is_not_valid(self, user, db):
        # Newly generated token is valid
        token = UserPasswordToken(user=user).save(db.session)
        assert token.invalid is False

        # Expired token is not valid
        token.update(expiration_dt=expired_date())
        token.save(db.session)
        assert token.invalid is True