Example #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, '/')
Example #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')
Example #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]))
Example #4
0
 def testShouldCreateHttpsConnectiomFromHttpsScheme(self):
     conn = PcsConnection()
     
     https_conn = conn.create_host_connection('https', 'localhost')
     
     self.assertEqual(https_conn.__class__.__name__, 'HTTPSConnection')