Skip to content

Commit

Permalink
test: Handle ret. created from get_or..from_claims
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-va committed Aug 8, 2024
1 parent da5de37 commit b42bc88
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lti_1p3_provider/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,19 @@ def test_get_or_create_from_claims(self):
sub = "randomly-selected-sub-for-testing"
aud = "randomly-selected-aud-for-testing"
self.assertFalse(LtiProfile.objects.exists())
profile = LtiProfile.objects.get_or_create_from_claims(
profile, created = LtiProfile.objects.get_or_create_from_claims(
iss=iss, aud=aud, sub=sub
)
self.assertIsNotNone(profile.user)
self.assertEqual(iss, profile.platform_id)
self.assertEqual(sub, profile.subject_id)
self.assertTrue(created)

profile_two = LtiProfile.objects.get_or_create_from_claims(
profile_two, created = LtiProfile.objects.get_or_create_from_claims(
iss=iss, aud=aud, sub=sub
)
self.assertEqual(profile_two, profile)
self.assertFalse(created)

def test_get_or_create_from_claims_twice(self):
"""
Expand Down Expand Up @@ -145,7 +147,7 @@ def test_get_from_user_id_when_no_profile_then_not_found(self):
LtiGradedResource.objects.get_from_user_id(user.pk)

def test_get_from_user_id_when_profile_then_found(self):
profile = LtiProfile.objects.get_or_create_from_claims(
profile, _ = LtiProfile.objects.get_or_create_from_claims(
iss=self.iss, aud=self.aud, sub=self.sub
)
LtiGradedResource.objects.create(profile=profile)
Expand Down Expand Up @@ -175,7 +177,7 @@ def test_upsert_from_ags_launch(self):
"title": "A custom title",
}

profile = LtiProfile.objects.get_or_create_from_claims(
profile, _ = LtiProfile.objects.get_or_create_from_claims(
iss=self.iss, aud=self.aud, sub=self.sub
)
res = LtiGradedResource.objects.upsert_from_ags_launch(
Expand Down

0 comments on commit b42bc88

Please sign in to comment.