Пример #1
0
    def test_register_fail(self, settings, pre_delete, post_save, pre_save, logger, dynamic_import):
        settings.LOGGED_MODELS = ('audit_tools.audit.tests.TestClass', )
        pre_save.connect.side_effect = Exception('TestException')

        signals.register_models()

        self.assertEqual(logger.error.call_count, 1)
Пример #2
0
    def test_register_ok(self, settings, pre_delete, post_save, pre_save, logger, dynamic_import):
        settings.LOGGED_MODELS = ('audit_tools.audit.fail.FailClass', )

        signals.register_models()

        self.assertEqual(pre_save.connect.call_count, 1)
        self.assertEqual(post_save.connect.call_count, 1)
        self.assertEqual(pre_delete.connect.call_count, 1)
        self.assertEqual(logger.error.call_count, 0)
Пример #3
0
 def ready(self):
     # Register all models listed in LOGGED_MODELS
     register_models()