mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Added unit tests for authorization service
CURA-5744
This commit is contained in:
parent
081b2a28fe
commit
1e5177a44f
2 changed files with 93 additions and 3 deletions
|
@ -93,7 +93,7 @@ class AuthorizationService:
|
|||
Refresh the access token when it expired.
|
||||
"""
|
||||
if self._auth_data is None or self._auth_data.refresh_token is None:
|
||||
Logger.log("w", "Unable to refresh acces token, since there is no refresh token.")
|
||||
Logger.log("w", "Unable to refresh access token, since there is no refresh token.")
|
||||
return
|
||||
self._storeAuthData(self._auth_helpers.getAccessTokenUsingRefreshToken(self._auth_data.refresh_token))
|
||||
self.onAuthStateChanged.emit(logged_in=True)
|
||||
|
@ -148,8 +148,8 @@ class AuthorizationService:
|
|||
if preferences_data:
|
||||
self._auth_data = AuthenticationResponse(**preferences_data)
|
||||
self.onAuthStateChanged.emit(logged_in=True)
|
||||
except ValueError as err:
|
||||
Logger.log("w", "Could not load auth data from preferences: %s", err)
|
||||
except ValueError:
|
||||
Logger.logException("w", "Could not load auth data from preferences")
|
||||
|
||||
def _storeAuthData(self, auth_data: Optional[AuthenticationResponse] = None) -> None:
|
||||
"""Store authentication data in preferences and locally."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue