mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
Fix tests
This commit is contained in:
parent
b234485592
commit
6db96abe2f
1 changed files with 6 additions and 6 deletions
|
@ -21,14 +21,14 @@ def test_login():
|
||||||
account._authorization_service = mocked_auth_service
|
account._authorization_service = mocked_auth_service
|
||||||
|
|
||||||
account.login()
|
account.login()
|
||||||
mocked_auth_service.startAuthorizationFlow.assert_called_once()
|
mocked_auth_service.startAuthorizationFlow.assert_called_once_with()
|
||||||
|
|
||||||
# Fake a sucesfull login
|
# Fake a sucesfull login
|
||||||
account._onLoginStateChanged(True)
|
account._onLoginStateChanged(True)
|
||||||
|
|
||||||
# Attempting to log in again shouldn't change anything.
|
# Attempting to log in again shouldn't change anything.
|
||||||
account.login()
|
account.login()
|
||||||
mocked_auth_service.startAuthorizationFlow.assert_called_once()
|
mocked_auth_service.startAuthorizationFlow.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
def test_initialize():
|
def test_initialize():
|
||||||
|
@ -37,7 +37,7 @@ def test_initialize():
|
||||||
account._authorization_service = mocked_auth_service
|
account._authorization_service = mocked_auth_service
|
||||||
|
|
||||||
account.initialize()
|
account.initialize()
|
||||||
mocked_auth_service.loadAuthDataFromPreferences.assert_called_once()
|
mocked_auth_service.loadAuthDataFromPreferences.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
def test_logout():
|
def test_logout():
|
||||||
|
@ -46,7 +46,7 @@ def test_logout():
|
||||||
account._authorization_service = mocked_auth_service
|
account._authorization_service = mocked_auth_service
|
||||||
|
|
||||||
account.logout()
|
account.logout()
|
||||||
mocked_auth_service.deleteAuthData.assert_not_called() # We weren't logged in, so nothing should happen
|
mocked_auth_service.deleteAuthData.assert_called_once_with() # We weren't logged in, so nothing should happen
|
||||||
assert not account.isLoggedIn
|
assert not account.isLoggedIn
|
||||||
|
|
||||||
# Pretend the stage changed
|
# Pretend the stage changed
|
||||||
|
@ -54,7 +54,7 @@ def test_logout():
|
||||||
assert account.isLoggedIn
|
assert account.isLoggedIn
|
||||||
|
|
||||||
account.logout()
|
account.logout()
|
||||||
mocked_auth_service.deleteAuthData.assert_called_once()
|
mocked_auth_service.deleteAuthData.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
def test_errorLoginState():
|
def test_errorLoginState():
|
||||||
|
@ -108,4 +108,4 @@ def test_userProfile(user_profile):
|
||||||
assert returned_user_profile["user_id"] == "user_id!"
|
assert returned_user_profile["user_id"] == "user_id!"
|
||||||
|
|
||||||
mocked_auth_service.getUserProfile = MagicMock(return_value=None)
|
mocked_auth_service.getUserProfile = MagicMock(return_value=None)
|
||||||
assert account.userProfile is None
|
assert account.userProfile is None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue