]> git.aero2k.de Git - sirius.git/commitdiff
test: mock twitter api call
authorPhillip Ferentinos <phillipjf@users.noreply.github.com>
Thu, 6 Jul 2023 18:49:02 +0000 (13:49 -0500)
committerPhillip Ferentinos <phillipjf@users.noreply.github.com>
Thu, 6 Jul 2023 18:49:02 +0000 (13:49 -0500)
sirius/web/test_oauth_flow.py

index b23c958facce459f72f5d94c0396ac6baac863e0..f554bf0e336abf8ca950d9ed4bdd32f1290624df 100644 (file)
@@ -1,3 +1,5 @@
+from unittest import mock
+
 import flask_testing as testing
 import flask_login as login
 
@@ -20,7 +22,9 @@ class TestOAuthFlow(testing.TestCase):
         app = webapp.create_app("test")
         return app
 
-    def test_oauth_authorized(self):
+    @mock.patch("twitter.get_self")
+    def test_oauth_authorized(self, get_self_mock):
+        get_self_mock.return_value = {"username": "test_screen_name"}
         self.assertEqual(login.current_user.is_authenticated, False)
         twitter.process_authorization(
             {"access_token": "token"},