Beispiel #1
0
 def testShouldParseUrlCorrectly1(self):
     conn = PcsConnection()
     url = 'http://www.google.com:8080/'
     
     scheme, host, path = conn.parse_url(url)
     
     self.assertEqual(scheme, PcsConnection.HTTP)
     self.assertEqual(host, 'www.google.com:8080')
     self.assertEqual(path, '/')
Beispiel #2
0
 def testShouldParseUrlCorrectly2(self):
     conn = PcsConnection()
     url = 'https://www.google.com/dir/index.php?arg=value'
     
     scheme, host, path = conn.parse_url(url)
     
     self.assertEqual(scheme, PcsConnection.HTTPS)
     self.assertEqual(host, 'www.google.com')
     self.assertEqual(path, '/dir/index.php?arg=value')
Beispiel #3
0
 def testInvalidUrlShouldRaiseException2(self):
     conn = PcsConnection()
     url = 'http://www.google.com'
     
     try:
         scheme, host, path = conn.parse_url(url)
     
     except PcsConnectionError:
         return
     
     self.fail('Should not parse invalid url %r as %r' % (url, [scheme, host, path]))