From 608cce491d82be9b29440e4da7a6a58b5c80d65f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 22 Nov 2021 18:45:04 +0100 Subject: [PATCH] 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. --- tests/API/TestAccount.py | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/tests/API/TestAccount.py b/tests/API/TestAccount.py index 6780e50b81..1ad73462c2 100644 --- a/tests/API/TestAccount.py +++ b/tests/API/TestAccount.py @@ -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())