diff --git a/tests/extras_appengine_auth_models_test.py b/tests/extras_appengine_auth_models_test.py index 42a3649..f80790a 100644 --- a/tests/extras_appengine_auth_models_test.py +++ b/tests/extras_appengine_auth_models_test.py @@ -141,14 +141,14 @@ def test_user_token(self): auth_id = 'foo' token = m.create_auth_token(auth_id) - self.assertTrue(m.validate_auth_token(auth_id, token)) + self.assertTrue(m.validate_auth_token(auth_id, token) != None) m.delete_auth_token(auth_id, token) - self.assertFalse(m.validate_auth_token(auth_id, token)) + self.assertNone(m.validate_auth_token(auth_id, token)) token = m.create_signup_token(auth_id) - self.assertTrue(m.validate_signup_token(auth_id, token)) + self.assertTrue(m.validate_signup_token(auth_id, token) != None) m.delete_signup_token(auth_id, token) - self.assertFalse(m.validate_signup_token(auth_id, token)) + self.assertNone(m.validate_signup_token(auth_id, token)) class TestUniqueModel(test_base.BaseTestCase): diff --git a/webapp2_extras/appengine/auth/models.py b/webapp2_extras/appengine/auth/models.py index 21dd9a1..4992b72 100644 --- a/webapp2_extras/appengine/auth/models.py +++ b/webapp2_extras/appengine/auth/models.py @@ -330,7 +330,7 @@ def validate_token(cls, user_id, subject, token): A :class:`UserToken` or None if the token does not exist. """ return cls.token_model.get(user=user_id, subject=subject, - token=token) is not None + token=token) @classmethod def create_auth_token(cls, user_id):