Пример #1
0
    def test_rejects_non_bugzilla_url(self):
        field = BugzillaURLField()

        with self.assertRaises(ValidationError):
            field.clean("www.example.com")
Пример #2
0
 def test_accepts_bugzilla_url(self):
     field = BugzillaURLField()
     bugzilla_url = "{base}/show_bug.cgi?id=123".format(
         base=settings.BUGZILLA_HOST)
     cleaned = field.clean(bugzilla_url)
     self.assertEqual(cleaned, bugzilla_url)
Пример #3
0
    def test_rejects_non_show_bug_bugzilla_url(self):
        field = BugzillaURLField()
        bugzilla_url = "{base}/123".format(base=settings.BUGZILLA_HOST)

        with self.assertRaises(ValidationError):
            field.clean(bugzilla_url)
Пример #4
0
 def test_accepts_bugzilla_url(self):
     field = BugzillaURLField()
     bugzilla_url = "{base}/123/".format(base=field.BUGZILLA_BASE_URL)
     cleaned = field.clean(bugzilla_url)
     self.assertEqual(cleaned, bugzilla_url)