Exemple #1
0
    def test_instance_error2(self):
        with self.assertRaises(ImproperlyConfigured) as cm:
            register_startup_checks_extra()

        expected_error_msg = (
            "RELATE_STARTUP_CHECKS_EXTRA must be an instance of list or tuple")
        self.assertIn(expected_error_msg, str(cm.exception))
Exemple #2
0
    def test_instance_error2(self):
        with self.assertRaises(ImproperlyConfigured) as cm:
            register_startup_checks_extra()

        expected_error_msg = (
            "RELATE_STARTUP_CHECKS_EXTRA must be an instance of list or tuple")
        self.assertIn(expected_error_msg, str(cm.exception))
Exemple #3
0
 def test_do_check(self):
     from tests.utils import mock
     with mock.patch("relate.checks.register") as mock_register:
         register_startup_checks_extra()
         self.assertEqual(mock_register.call_count, 2)
         stringified_call_args = ". ".join(
             [repr(call) for call in mock_register.call_args_list])
         self.assertIn(
             "function my_custom_check_func1", stringified_call_args)
         self.assertIn(
             "function my_custom_check_func2", stringified_call_args)
Exemple #4
0
 def test_do_check(self):
     from tests.utils import mock
     with mock.patch("relate.checks.register") as mock_register:
         register_startup_checks_extra()
         self.assertEqual(mock_register.call_count, 2)
         stringified_call_args = ". ".join(
             [repr(call) for call in mock_register.call_args_list])
         self.assertIn("function my_custom_check_func1",
                       stringified_call_args)
         self.assertIn("function my_custom_check_func2",
                       stringified_call_args)
Exemple #5
0
    def ready(self):
        import course.receivers  # noqa

        # register all checks
        register_startup_checks()
        register_startup_checks_extra()
Exemple #6
0
    def ready(self):
        import course.receivers  # noqa

        # register all checks
        register_startup_checks()
        register_startup_checks_extra()
Exemple #7
0
 def test_not_importable_check_func(self):
     with self.assertRaises(ImproperlyConfigured) as cm:
         register_startup_checks_extra()
     expected_error_msg = ("No module named 'unknown_package'")
     self.assertIn(expected_error_msg, str(cm.exception))
Exemple #8
0
 def test_empty_list(self):
     register_startup_checks_extra()
Exemple #9
0
 def test_none(self):
     register_startup_checks_extra()
Exemple #10
0
 def test_not_configured(self):
     del settings.RELATE_STARTUP_CHECKS_EXTRA
     register_startup_checks_extra()
Exemple #11
0
 def test_not_importable_check_func(self):
     with self.assertRaises(ImproperlyConfigured) as cm:
         register_startup_checks_extra()
     expected_error_msg = ("No module named 'unknown_package'")
     self.assertIn(expected_error_msg, str(cm.exception))
Exemple #12
0
 def test_empty_list(self):
     register_startup_checks_extra()
Exemple #13
0
 def test_none(self):
     register_startup_checks_extra()
Exemple #14
0
 def test_not_configured(self):
     del settings.RELATE_STARTUP_CHECKS_EXTRA
     register_startup_checks_extra()