Esempio n. 1
0
    def test_check_url(self):
        assert check_url("http://www.douban.com/people/ahbei") is None
        assert check_url("http://127.0.0.1:8000/") is None

        illegal_url = "wobushigeurl."
        very_long_url = "http://douban.com/%s" % "ahbei" * 500
        assert check_url(illegal_url) == "Url is illegal"
        assert check_url(very_long_url) == "Url is too long"
Esempio n. 2
0
    def test_check_url(self):
        assert check_url("http://www.douban.com/people/ahbei") is None
        assert check_url("http://127.0.0.1:8000/") is None

        illegal_url = "wobushigeurl."
        very_long_url = "http://douban.com/%s" % "ahbei"* 500
        assert check_url(illegal_url) == "Url is illegal"
        assert check_url(very_long_url) == "Url is too long"
Esempio n. 3
0
 def validate(self):
     errors = []
     validators = [check_url(
         self.url, 'Url'), check_integer(self.project_id, 'Project ID')]
     for error in validators:
         if error:
             errors.append(error)
     return errors