providers/saml: fix managed mappings not being set on import

This commit is contained in:
Jens Langhammer 2021-02-16 19:20:52 +01:00
parent 0ade57b5a6
commit 61772b75ff
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ class ServiceProviderMetadata:
# Set all auto-generated Property-mappings as defaults # Set all auto-generated Property-mappings as defaults
# They should provide a sane default for most applications: # They should provide a sane default for most applications:
provider.property_mappings.set( provider.property_mappings.set(
SAMLPropertyMapping.objects.filter(name__startswith="Autogenerated") SAMLPropertyMapping.objects.exclude(managed__isnull=True)
) )
provider.save() provider.save()
return provider return provider

View File

@ -78,7 +78,7 @@ class TestServiceProviderMetadataParser(TestCase):
self.assertEqual(provider.sp_binding, SAMLBindings.POST) self.assertEqual(provider.sp_binding, SAMLBindings.POST)
self.assertEqual( self.assertEqual(
len(provider.property_mappings.all()), len(provider.property_mappings.all()),
len(SAMLPropertyMapping.objects.filter(name__startswith="Autogenerated")), len(SAMLPropertyMapping.objects.exclude(managed__isnull=True)),
) )
def test_with_signing_cert(self): def test_with_signing_cert(self):