Fixhancement: better handle removed social apps in profile (#9876)

This commit is contained in:
shamoon
2025-05-11 12:55:33 -07:00
committed by GitHub
parent a61f5ac64c
commit 73f0f1212d
2 changed files with 36 additions and 2 deletions

View File

@@ -136,6 +136,36 @@ class TestApiProfile(DirectoriesMixin, APITestCase):
],
)
def test_profile_w_social_removed_app(self):
"""
GIVEN:
- Configured user and setup social account
- Social app has been removed
WHEN:
- API call is made to get profile
THEN:
- Profile is returned with "Unknown App" as name
"""
self.setupSocialAccount()
# Remove the social app
SocialApp.objects.get(provider_id="keycloak-test").delete()
response = self.client.get(self.ENDPOINT)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(
response.data["social_accounts"],
[
{
"id": 1,
"provider": "keycloak-test",
"name": "Unknown App",
},
],
)
def test_update_profile(self):
"""
GIVEN: