Remove tests checking for data in UserProfile

The UserProfile is being stored in the account with a simple assignment, and these are just some property getters with a fallback. I don't think we need to test that.
The actual getting of a user profile (and whether that returns correctly when logged out and such) is already tested as part of the OAuth flow where that code lives.

Contributes to issue CURA-8539.
This commit is contained in:
Ghostkeeper 2021-11-22 18:45:04 +01:00
parent 1cdeb7d56b
commit 608cce491d
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -80,46 +80,6 @@ def test_errorLoginState(application):
account._onLoginStateChanged(False, "OMGZOMG!")
account.loginStateChanged.emit.called_with(False)
def test_userName(user_profile):
account = Account(MagicMock())
mocked_auth_service = MagicMock()
account._authorization_service = mocked_auth_service
mocked_auth_service.getUserProfile = MagicMock(return_value = user_profile)
assert account.userName == "username!"
mocked_auth_service.getUserProfile = MagicMock(return_value=None)
assert account.userName is None
def test_profileImageUrl(user_profile):
account = Account(MagicMock())
mocked_auth_service = MagicMock()
account._authorization_service = mocked_auth_service
mocked_auth_service.getUserProfile = MagicMock(return_value = user_profile)
assert account.profileImageUrl == "profile_image_url!"
mocked_auth_service.getUserProfile = MagicMock(return_value=None)
assert account.profileImageUrl is None
def test_userProfile(user_profile):
account = Account(MagicMock())
mocked_auth_service = MagicMock()
account._authorization_service = mocked_auth_service
mocked_auth_service.getUserProfile = MagicMock(return_value=user_profile)
returned_user_profile = account.userProfile
assert returned_user_profile["username"] == "username!"
assert returned_user_profile["profile_image_url"] == "profile_image_url!"
assert returned_user_profile["user_id"] == "user_id!"
mocked_auth_service.getUserProfile = MagicMock(return_value=None)
assert account.userProfile is None
def test_sync_success():
account = Account(MagicMock())