diff options
author | Ghostkeeper <rubend@tutanota.com> | 2021-11-22 12:48:45 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-11-22 12:48:45 +0300 |
commit | 9dd251975d2fbf339021976cf9f202c8a545c13c (patch) | |
tree | 81dbf0e8f6ba4284b18d77f1b83e559879485991 /tests/TestOAuth2.py | |
parent | 30d19844f2cd24c0b1640dfa66837c82634310ce (diff) |
Test for result of callback with a callable
In this case the callback should get called immediately (no wait) so it is safe to test for this callback, albeit slightly implementation-defined.
Contributes to issue CURA-8539.
Diffstat (limited to 'tests/TestOAuth2.py')
-rw-r--r-- | tests/TestOAuth2.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/TestOAuth2.py b/tests/TestOAuth2.py index 2c039b296a..24cfe50921 100644 --- a/tests/TestOAuth2.py +++ b/tests/TestOAuth2.py @@ -1,5 +1,5 @@ from datetime import datetime -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock, Mock, patch import requests @@ -53,7 +53,11 @@ def test_cleanAuthService() -> None: # Ensure that when setting up an AuthorizationService, no data is set. authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences()) authorization_service.initialize() - assert authorization_service.getUserProfile() is None + + mock_callback = Mock() + authorization_service.getUserProfile(mock_callback) + mock_callback.assert_called_once_with(None) + assert authorization_service.getAccessToken() is None |