authentik.tasks.tests.test_actors

 1from django.test import TestCase
 2from dramatiq.broker import get_broker
 3
 4
 5class TestActors(TestCase):
 6    def test_all_actors_have_description(self):
 7        broker = get_broker()
 8        for actor_name in broker.get_declared_actors():
 9            actor = broker.get_actor(actor_name)
10            self.assertIn("description", actor.options)
class TestActors(django.test.testcases.TestCase):
 6class TestActors(TestCase):
 7    def test_all_actors_have_description(self):
 8        broker = get_broker()
 9        for actor_name in broker.get_declared_actors():
10            actor = broker.get_actor(actor_name)
11            self.assertIn("description", actor.options)

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_all_actors_have_description(self):
 7    def test_all_actors_have_description(self):
 8        broker = get_broker()
 9        for actor_name in broker.get_declared_actors():
10            actor = broker.get_actor(actor_name)
11            self.assertIn("description", actor.options)