Ejemplo n.º 1
0
 def with_missing_tld():
     expect(URL(URL_NO_TLD).errors) == [
         "Unable to connect to domain.",
         "URL responded with a non-successful status code: (no response)",
     ]
Ejemplo n.º 2
0
 def with_non_url():
     expect(URL(NON_URL).errors) == [
         "Invalid URL 'example': No schema supplied. Perhaps you meant http://example?",
         "URL responded with a non-successful status code: (no response)",
     ]
Ejemplo n.º 3
0
 def with_invalid_scheme():
     expect(URL(URL_BAD_SCHEME).errors) == [
         "No connection adapters were found for 'foobar://example.com'",
         "URL responded with a non-successful status code: (no response)",
     ]
Ejemplo n.º 4
0
 def with_missing_scheme():
     expect(URL(URL_NO_SCHEME).errors) == [
         "Invalid URL 'example.com': No schema supplied. Perhaps you meant http://example.com?",
         "URL responded with a non-successful status code: (no response)",
     ]
Ejemplo n.º 5
0
 def with_unsuccessful_status_code():
     expect(URL(URL_404).errors) == [
         "URL responded with a non-successful status code: 404",
     ]
Ejemplo n.º 6
0
 def with_valid_url():
     expect(URL(URL_200).errors) == []
Ejemplo n.º 7
0
 def is_based_on_valid_url_and_success_status(url, valid):
     expect(URL(url).valid) == valid
Ejemplo n.º 8
0
 def is_none_with_invalid_url():
     expect(URL(URL_BAD_SCHEME).status_code) == None
Ejemplo n.º 9
0
 def is_based_on_response_status_code(url, valid):
     expect(URL(url).status_code) == valid