Example #1
0
 def testMultiQueryParameters(self):
     http_url = "http://www.google.com:80/mail?locale=en_US&support=true#tab1"
     url = Url(http_url)
     parameters = url.get_query_parameters()
     self.assertTrue("locale" in parameters)
     self.assertEqual("en_US", parameters["locale"])
     self.assertTrue("support" in parameters)
     self.assertEqual("true", parameters["support"])
Example #2
0
 def testUrl(self):
     http_url = "http://www.google.com:80/mail?locale=en_US#tab1"
     url = Url(http_url)
     self.assertEqual("http", url.protocol)
     self.assertEqual("www.google.com", url.hostname)
     self.assertEqual(80, url.port)
     self.assertEqual("tab1", url.hash)
     self.assertEqual("locale=en_US", url.query)
Example #3
0
 def testNoQueryParameters(self):
     http_url = "http://www.google.com:80/mail?missingValue#tab1"
     url = Url(http_url)
     parameters = url.get_query_parameters()
     self.assertTrue(len(parameters) == 0, parameters)
Example #4
0
 def testSingleQueryParameter(self):
     http_url = "http://www.google.com:80/mail?locale=en_US#tab1"
     url = Url(http_url)
     parameters = url.get_query_parameters()
     self.assertTrue("locale" in parameters)
     self.assertEqual("en_US", parameters["locale"])
Example #5
0
 def testInputOutput(self):
     http_url = "http://www.google.com:80/mail?locale=en_US#tab1"
     url = Url(http_url)
     self.assertEqual(http_url, str(url))