From: Phillip Ferentinos Date: Thu, 6 Jul 2023 18:49:02 +0000 (-0500) Subject: test: mock twitter api call X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=61b935b6aecfd03f606c4f521c31510e7950e7aa;p=sirius.git test: mock twitter api call --- diff --git a/sirius/web/test_oauth_flow.py b/sirius/web/test_oauth_flow.py index b23c958..f554bf0 100644 --- a/sirius/web/test_oauth_flow.py +++ b/sirius/web/test_oauth_flow.py @@ -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"},