本文整理汇总了Python中celery.fixups.django.DjangoFixup类的典型用法代码示例。如果您正苦于以下问题:Python DjangoFixup类的具体用法?Python DjangoFixup怎么用?Python DjangoFixup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DjangoFixup类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_autodiscover_tasks
def test_autodiscover_tasks(self, patching):
patching.modules('django.apps')
from django.apps import apps
f = DjangoFixup(self.app)
configs = [Mock(name='c1'), Mock(name='c2')]
apps.get_app_configs.return_value = configs
assert f.autodiscover_tasks() == [c.name for c in configs]
示例2: test_autodiscover_tasks
def test_autodiscover_tasks(self):
self.mock_modules('django.apps')
from django.apps import apps
f = DjangoFixup(self.app)
configs = [Mock(name='c1'), Mock(name='c2')]
apps.get_app_configs.return_value = configs
self.assertEqual(
f.autodiscover_tasks(),
[c.name for c in configs],
)
示例3: test_on_import_modules
def test_on_import_modules(self):
f = DjangoFixup(self.app)
f.worker_fixup = Mock(name='worker_fixup')
f.on_import_modules()
f.worker_fixup.validate_models.assert_called_with()
示例4: test_worker_fixup_property
def test_worker_fixup_property(self, DjangoWorkerFixup):
f = DjangoFixup(self.app)
f._worker_fixup = None
assert f.worker_fixup is DjangoWorkerFixup()
assert f.worker_fixup is DjangoWorkerFixup()
示例5: test_autodiscover_tasks_pre17
def test_autodiscover_tasks_pre17(self):
self.mask_modules('django.apps')
f = DjangoFixup(self.app)
f._settings = Mock(name='_settings')
self.assertIs(f.autodiscover_tasks(), f._settings.INSTALLED_APPS)
示例6: test_worker_fixup_property
def test_worker_fixup_property(self, DjangoWorkerFixup):
f = DjangoFixup(self.app)
f._worker_fixup = None
self.assertIs(f.worker_fixup, DjangoWorkerFixup())
self.assertIs(f.worker_fixup, DjangoWorkerFixup())