gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / httplib2 / test / test_no_socket.py @ 564
History | View | Annotate | Download (704 Bytes)
1 |
"""Tests for httplib2 when the socket module is missing.
|
---|---|
2 |
|
3 |
This helps ensure compatibility with environments such as AppEngine.
|
4 |
"""
|
5 |
import os |
6 |
import sys |
7 |
import unittest |
8 |
|
9 |
import httplib2 |
10 |
|
11 |
class MissingSocketTest(unittest.TestCase): |
12 |
def setUp(self): |
13 |
self._oldsocks = httplib2.socks
|
14 |
httplib2.socks = None
|
15 |
|
16 |
def tearDown(self): |
17 |
httplib2.socks = self._oldsocks
|
18 |
|
19 |
def testProxyDisabled(self): |
20 |
proxy_info = httplib2.ProxyInfo('blah',
|
21 |
'localhost', 0) |
22 |
client = httplib2.Http(proxy_info=proxy_info) |
23 |
self.assertRaises(httplib2.ProxiesUnavailableError,
|
24 |
client.request, 'http://localhost:-1/')
|