Beispiel #1
0
 def test_path_url_encoded(self):
     """
     A path is URL encoded when necessary.
     """
     parsed = urlparse('https://www.amazon.com/\xe2')
     self.assertEqual(_make_canonical_uri(parsed),
                      "https://www.amazon.com/%E2")
Beispiel #2
0
 def test_path_url_encoded(self):
     """
     A path is URL encoded when necessary.
     """
     parsed = urlparse.urlparse('https://www.amazon.com/\xe2')
     self.assertEqual(_make_canonical_uri(parsed),
                      "https://www.amazon.com/%E2")
Beispiel #3
0
 def test_path(self):
     """
     A URL with a path has a canonical URI with the same path.
     """
     self.assertEqual(
         _make_canonical_uri(urlparse('https://www.amazon.com/a/b')),
         "https://www.amazon.com/a/b")
Beispiel #4
0
 def test_path_not_normalized(self):
     """
     A URL whose path has duplicate slashes has a canonical URI
     with duplicated slashes.
     """
     self.assertEqual(
         _make_canonical_uri(urlparse('https://www.amazon.com//a/b')),
         "https://www.amazon.com//a/b")
Beispiel #5
0
 def test_empty_path(self):
     """
     A URL with an empty path has a canonical URI with an empty
     path.
     """
     self.assertEqual(
         _make_canonical_uri(urlparse('https://www.amazon.com/')),
         "https://www.amazon.com/")
Beispiel #6
0
 def test_path(self):
     """
     A URL with a path has a canonical URI with the same path.
     """
     self.assertEqual(
         _make_canonical_uri(
             urlparse.urlparse('https://www.amazon.com/a/b')),
         "https://www.amazon.com/a/b")
Beispiel #7
0
 def test_empty_path(self):
     """
     A URL with an empty path has a canonical URI with an empty
     path.
     """
     self.assertEqual(
         _make_canonical_uri(urlparse.urlparse('https://www.amazon.com/')),
         "https://www.amazon.com/")
Beispiel #8
0
 def test_path_not_normalized(self):
     """
     A URL whose path has duplicate slashes has a canonical URI
     with duplicated slashes.
     """
     self.assertEqual(
         _make_canonical_uri(
             urlparse.urlparse('https://www.amazon.com//a/b')),
         "https://www.amazon.com//a/b")
Beispiel #9
0
 def test_query_params_and_fragments_removed(self):
     """
     A URL's canonical URI has that URL's query string, parameters, and
     fragment removed.
     """
     parsed = urlparse('https://www.amazon.com//a/b')
     parsed = parsed._replace(query="query=1",
                              params="params",
                              fragment="fragment")
     self.assertEqual(_make_canonical_uri(parsed),
                      "https://www.amazon.com//a/b")
Beispiel #10
0
 def test_query_params_and_fragments_removed(self):
     """
     A URL's canonical URI has that URL's query string, parameters, and
     fragment removed.
     """
     parsed = urlparse.urlparse('https://www.amazon.com//a/b')
     parsed = parsed._replace(query="query=1",
                              params="params",
                              fragment="fragment")
     self.assertEqual(_make_canonical_uri(parsed),
                      "https://www.amazon.com//a/b")