Example #1
0
 def test_invalid(self):
     with self.assertRaises(BadOption):
         DirectSplashProxyFactory('This is not a valid URL')
     with self.assertRaises(BadOption):
         DirectSplashProxyFactory('ftp://proxy.com')
     with self.assertRaises(BadOption):
         DirectSplashProxyFactory('relative_url')
Example #2
0
 def test_parse(self):
     factory = DirectSplashProxyFactory('http://*****:*****@proxy.com:1234')
     self.assertEqual(factory.proxy.port(), 1234)
     self.assertEqual(factory.proxy.user(), 'pepe')
     self.assertEqual(factory.proxy.password(), 'hunter2')
     self.assertEqual(factory.proxy.hostName(), 'proxy.com')
     self.assertEqual(factory.proxy.type(), PROXY_TYPES['HTTP'])
Example #3
0
 def test_socks5(self):
     factory = DirectSplashProxyFactory('socks5://proxy.com')
     self.assertEquals(factory.proxy.type(), PROXY_TYPES['SOCKS5'])
Example #4
0
 def test_default_port(self):
     factory = DirectSplashProxyFactory('http://proxy.com')
     self.assertEquals(factory.proxy.port(), 1080)