示例#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")
示例#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")
示例#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")
示例#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")
示例#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/")
示例#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")
示例#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/")
示例#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")
示例#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")
示例#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")