1"""Tests for httplib2 when the socket module is missing.
2
3This helps ensure compatibility with environments such as AppEngine.
4"""
5import os
6import sys
7import unittest
8
9import httplib2
10
11
12class MissingSocketTest(unittest.TestCase):
13    def setUp(self):
14        self._oldsocks = httplib2.socks
15        httplib2.socks = None
16
17    def tearDown(self):
18        httplib2.socks = self._oldsocks
19
20    def testProxyDisabled(self):
21        proxy_info = httplib2.ProxyInfo("blah", "localhost", 0)
22        client = httplib2.Http(proxy_info=proxy_info)
23        self.assertRaises(
24            httplib2.ProxiesUnavailableError, client.request, "http://localhost:-1/"
25        )
26