def test_url_validator_when_invalid_format(): # GIVEN url = "https://www. example.com" # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert not is_valid
def test_url_validator_when_email_is_number(): # GIVEN url = 123 # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert not is_valid
def test_url_validator_when_missing_domain_extension(): # GIVEN url = "https://example." # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert not is_valid
def test_url_validator_when_missing_domain(): # GIVEN url = "https://.com" # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert not is_valid
def url(self, url): if url is None: raise ValidationException('empty_url_input', "'url' is missing") if not UrlValidator.is_valid(url): raise ValidationException('invalid_url_input', "'url' contains an invalid URL") self.__url = url
def test_url_validator_when_email_is_valid(url): # GIVEN 'url' method parameter # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert is_valid
def test_url_validator_when_missing_or_empty_value(url): # GIVEN 'url' method parameter # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert not is_valid
def test_url_validator_when_invalid_protocol(url): # GIVEN 'url' method parameter # WHEN is_valid = UrlValidator.is_valid(url) # THEN assert not is_valid