Ejemplo n.º 1
0
 def test_validate_url_with_protocol_as_url(self):
     url = self.VALID_PROTOCOL
     protocol = self.VALID_PROTOCOL
     valid = UrlArgProcessing.validate_url(url=url, protocol=protocol)
     assert_false(
         valid,
         f"Invalid URL ({url}) was marked as valid with valid protocol ({protocol})."
     )
Ejemplo n.º 2
0
 def test_validate_url_with_invalid_protocol(self):
     url = self.VALID_URL
     protocol = "\r\ninvalid"
     valid = UrlArgProcessing.validate_url(url=url, protocol=protocol)
     assert_false(
         valid,
         f"Valid URL ({url}) was marked as valid with invalid protocol ({protocol})."
     )
Ejemplo n.º 3
0
 def test_validate_url_with_protocol_mixed_case(self):
     url = self.VALID_URL
     protocol = self.VALID_PROTOCOL.capitalize()
     valid = UrlArgProcessing.validate_url(url=url, protocol=protocol)
     assert_true(
         valid,
         f"Valid URL ({url}) was marked as invalid with valid protocol ({protocol})."
     )
Ejemplo n.º 4
0
 def test_validate_invalid_url_with_valid_protocol_and_valid_domain(self):
     url = self.INVALID_URL
     domain = self.VALID_DOMAIN
     protocol = self.VALID_PROTOCOL
     valid = UrlArgProcessing.validate_url(
         url=url, protocol=protocol, domains=[domain, self.INVALID_DOMAIN])
     assert_false(valid,
                  (f"Invalid URL ({url}) was marked as valid with valid "
                   f"protocol ({protocol}) and valid domain ({domain})."))
Ejemplo n.º 5
0
 def test_validate_url_with_valid_url_and_none_domain(self):
     url = self.VALID_URL
     domain = None
     protocol = self.VALID_PROTOCOL
     valid = UrlArgProcessing.validate_url(url=url,
                                           protocol=protocol,
                                           domains=[domain])
     assert_true(valid,
                 (f"Valid URL ({url}) was marked as invalid with valid "
                  f"protocol ({protocol}) and domain ({domain})."))
Ejemplo n.º 6
0
 def test_validate_url_with_invalid_url(self):
     url = self.INVALID_URL
     valid = UrlArgProcessing.validate_url(url=url)
     assert_false(valid, f"Invalid URL ({url}) was marked as valid.")
Ejemplo n.º 7
0
 def test_validate_url_with_valid_url_mixed_case(self):
     url = self.VALID_URL.capitalize()
     valid = UrlArgProcessing.validate_url(url=url)
     assert_true(valid, f"Valid URL ({url}) was marked as invalid.")
Ejemplo n.º 8
0
 def test_validate_url_with_valid_url_lowercase(self):
     url = self.VALID_URL
     valid = UrlArgProcessing.validate_url(url=url)
     assert_true(valid, f"Valid URL ({url}) was marked as invalid.")