authentik.blueprints.tests.test_managed_app_config

 1from django.test import TestCase
 2
 3from authentik.blueprints.apps import ManagedAppConfig
 4from authentik.enterprise.apps import EnterpriseConfig
 5from authentik.lib.utils.reflection import get_apps
 6
 7
 8class TestManagedAppConfig(TestCase):
 9    def test_apps_use_managed_app_config(self):
10        for app in get_apps():
11            if app.name.startswith("authentik.enterprise"):
12                self.assertIn(EnterpriseConfig, app.__class__.__bases__)
13            else:
14                self.assertIn(ManagedAppConfig, app.__class__.__bases__)
class TestManagedAppConfig(django.test.testcases.TestCase):
 9class TestManagedAppConfig(TestCase):
10    def test_apps_use_managed_app_config(self):
11        for app in get_apps():
12            if app.name.startswith("authentik.enterprise"):
13                self.assertIn(EnterpriseConfig, app.__class__.__bases__)
14            else:
15                self.assertIn(ManagedAppConfig, app.__class__.__bases__)

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_apps_use_managed_app_config(self):
10    def test_apps_use_managed_app_config(self):
11        for app in get_apps():
12            if app.name.startswith("authentik.enterprise"):
13                self.assertIn(EnterpriseConfig, app.__class__.__bases__)
14            else:
15                self.assertIn(ManagedAppConfig, app.__class__.__bases__)