Beispiel #1
0
 def test_not_implemented_error(self):
     with self.assertRaises(NotImplementedError):
         Colour()
Beispiel #2
0
    "admin/login.html",
]

# '10 hours of'...
SPAM_URLS = [spam for spam in SPAM_ENUMS]

# check if any settings vars have been included to add to the
# list of routes or urls
if hasattr(settings, "SPAM_ROUTES"):
    SPAM_ROUTES += settings.SPAM_ROUTES


# check for excluded routes
if hasattr(settings, "EXCLUDED_ROUTES"):
    for route in settings.EXCLUDED_ROUTES:
        if route in SPAM_ROUTES:
            SPAM_ROUTES.remove(route)
        else:
            print(
                Colour.text(
                    'Warning: "'
                    + route
                    + '" is not included in django_spam.SPAM_ROUTES.',
                    "warn",
                )
            )

# NOTE: temp disbaling custom routes
# if hasattr(settings, "SPAM_URLS"):
#     SPAM_URLS += settings.SPAM_URLS
Beispiel #3
0
 def test_warn_text(self):
     warn_text = Colour.text("Warn text.", "warn")
     self.assertIn("Warn text.", warn_text)
Beispiel #4
0
 def test_no_status_text(self):
     warn_text = Colour.text("Warn text.")  # pylint: disable=no-value-for-parameter
     self.assertIn("Warn text.", warn_text)
Beispiel #5
0
 def test_ok_text(self):
     ok_text = Colour.text("Ok text.", "ok")
     self.assertIn("Ok text.", ok_text)
Beispiel #6
0
 def test_fail_text(self):
     fail_text = Colour.text("Fail text.", "fail")
     self.assertIn("Fail text.", fail_text)
Beispiel #7
0
 def test_warn_text(self):
     warn_text = Colour.text('Warn text.', 'warn')
     self.assertIn('Warn text.', warn_text)
Beispiel #8
0
 def test_ok_text(self):
     ok_text = Colour.text('Ok text.', 'ok')
     self.assertIn('Ok text.', ok_text)
Beispiel #9
0
 def test_fail_text(self):
     fail_text = Colour.text('Fail text.', 'fail')
     self.assertIn('Fail text.', fail_text)