]> git.aero2k.de Git - sirius.git/commitdiff
Add is_authenticated method to User model.
authorTom Hunger <tehunger@gmail.com>
Mon, 12 Jan 2015 19:33:15 +0000 (19:33 +0000)
committerTom Hunger <tehunger@gmail.com>
Mon, 12 Jan 2015 19:57:22 +0000 (19:57 +0000)
sirius/models/user.py
sirius/web/test_oauth_flow.py

index 7b07eaf847f0ecf753563eb39b40afda440e7284..5d95baf9ebc71a9b7649b863f80652788ef4e10a 100644 (file)
@@ -26,6 +26,9 @@ class User(db.Model):
     def get_id(self):
         return self.id
 
+    def is_authenticated(self):
+        return True
+
     def claim_printer(self, claim_code):
         """Claiming can happen before the printer "calls home" for the first
         time so we need to be able to deal with that."""
index ff3e0c074f6016460736f924ab2b233ed01d565b..cf33aa64105a060eb4cc0f37f98bce439bedf36d 100644 (file)
@@ -21,6 +21,7 @@ class TestClaiming(testing.TestCase):
         return app
 
     def test_oauth_authorized(self):
+        self.assertEqual(login.current_user.is_authenticated(), False)
         twitter.process_authorization(
             'token',
             'secret_token',
@@ -28,3 +29,4 @@ class TestClaiming(testing.TestCase):
             '/next_url',
         )
         self.assertEqual(login.current_user.username, 'test_screen_name')
+        self.assertEqual(login.current_user.is_authenticated(), True)