diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2019-08-15 10:23:05 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-08-15 10:23:05 +0300 |
commit | e8fd013329923a5ce2e2800f4142cbfc04ba4b74 (patch) | |
tree | d850947891579dddd0e2706e6457017930fba4ca /tests/TestOAuth2.py | |
parent | 4c792419e30eeca389f7796a4f5feadd32b59963 (diff) |
Fix OAuth2 test
Diffstat (limited to 'tests/TestOAuth2.py')
-rw-r--r-- | tests/TestOAuth2.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/TestOAuth2.py b/tests/TestOAuth2.py index 358ed5afbb..1e305c6549 100644 --- a/tests/TestOAuth2.py +++ b/tests/TestOAuth2.py @@ -1,9 +1,10 @@ -import webbrowser from datetime import datetime from unittest.mock import MagicMock, patch import requests +from PyQt5.QtGui import QDesktopServices + from UM.Preferences import Preferences from cura.OAuth2.AuthorizationHelpers import AuthorizationHelpers, TOKEN_TIMESTAMP_FORMAT from cura.OAuth2.AuthorizationService import AuthorizationService @@ -172,12 +173,12 @@ def test_storeAuthData(get_user_profile) -> None: @patch.object(LocalAuthorizationServer, "stop") @patch.object(LocalAuthorizationServer, "start") -@patch.object(webbrowser, "open_new") -def test_localAuthServer(webbrowser_open, start_auth_server, stop_auth_server) -> None: +@patch.object(QDesktopServices, "openUrl") +def test_localAuthServer(QDesktopServices_openUrl, start_auth_server, stop_auth_server) -> None: preferences = Preferences() authorization_service = AuthorizationService(OAUTH_SETTINGS, preferences) authorization_service.startAuthorizationFlow() - assert webbrowser_open.call_count == 1 + assert QDesktopServices_openUrl.call_count == 1 # Ensure that the Authorization service tried to start the server. assert start_auth_server.call_count == 1 |