authentik.providers.scim.tests.test_schema

 1from django.test import TestCase
 2from pydantic import ValidationError
 3
 4from authentik.providers.scim.clients.schema import Email
 5
 6
 7class TestSCIMSchema(TestCase):
 8    def test_email(self):
 9        """Ensure that email addresses that validate in django validate in SCIM"""
10        Email.model_validate({"value": "foo@bar.com"})
11        Email.model_validate({"value": "username@testipa.local"})
12        with self.assertRaises(ValidationError):
13            Email.model_validate({"value": "username"})
class TestSCIMSchema(django.test.testcases.TestCase):
 8class TestSCIMSchema(TestCase):
 9    def test_email(self):
10        """Ensure that email addresses that validate in django validate in SCIM"""
11        Email.model_validate({"value": "foo@bar.com"})
12        Email.model_validate({"value": "username@testipa.local"})
13        with self.assertRaises(ValidationError):
14            Email.model_validate({"value": "username"})

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

def test_email(self):
 9    def test_email(self):
10        """Ensure that email addresses that validate in django validate in SCIM"""
11        Email.model_validate({"value": "foo@bar.com"})
12        Email.model_validate({"value": "username@testipa.local"})
13        with self.assertRaises(ValidationError):
14            Email.model_validate({"value": "username"})

Ensure that email addresses that validate in django validate in SCIM