Fix assertion of resulting profile via callback

Needs to work differently with the asynchronous workflow.

Contributes to issue CURA-8539.
This commit is contained in:
Ghostkeeper 2021-11-22 15:54:42 +01:00
parent fbbf1427b3
commit 4b5d698325
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -297,9 +297,11 @@ def test_loginAndLogout() -> None:
def test_wrongServerResponses() -> None:
authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences())
authorization_service.initialize()
with patch.object(AuthorizationHelpers, "parseJWT", return_value=UserProfile()):
authorization_service._onAuthStateChanged(MALFORMED_AUTH_RESPONSE)
assert authorization_service.getUserProfile() is None
authorization_service._onAuthStateChanged(MALFORMED_AUTH_RESPONSE)
def callback(profile):
assert profile is None
authorization_service.getUserProfile(callback)
def test__generate_auth_url() -> None:
preferences = Preferences()