def test_get_claims_no_change(self): cp = get_claims_provider()(user=self.test_user) claims = cp.get_claims() self.assertEqual(claims["email"], "*****@*****.**") self.assertEqual(claims['vot'], "P0.Cc") self.assertEqual(claims['aal'], "1")
def test_email_verified_claim(self): cp = get_claims_provider()(user=self.test_user) claims = cp.get_claims() self.assertTrue(claims['email_verified'])
def test_get_claims(self): cp = get_claims_provider()(user=self.dev_user) claims = cp.get_claims() self.assertEqual(claims["email"], "*****@*****.**") self.assertEqual(claims['vot'], "P0.Ce") self.assertEqual(claims['aal'], "2")
SEX_CHOICES, ) from apps.oidc.claims import get_claims_provider # { # "username": "******", # "given_name": "James", # "family_name": "Kirk", # "gender": "male", # "password": "******", # "birthdate": "1952-01-03", # "nickname": "Jim", # "phone_number": "+15182345678", # "email": "*****@*****.**" # } User = get_user_model() ClaimsProvider = get_claims_provider() class UserFilter(filters.FilterSet): first_or_last_name = filters.CharFilter(method='filter_first_or_last_name') def filter_first_or_last_name(self, queryset, name, value): """Filter by the UserProfile's User's first_name or last_name.""" return queryset.filter( Q(user__first_name__icontains=value) | Q(user__last_name__icontains=value)) class Meta: model = UserProfile fields = ['first_or_last_name']