]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
cleanup
authorKevin McCarthy <me@kevinmccarthy.org>
Mon, 2 Jul 2012 20:00:18 +0000 (10:00 -1000)
committerKevin McCarthy <me@kevinmccarthy.org>
Mon, 2 Jul 2012 20:00:18 +0000 (10:00 -1000)
test.py
vcr/stubs.py

diff --git a/test.py b/test.py
index ccb2cbbe49ef563aafd03c3ccbc93f62bf97727a..c8e926d018699f522c33151b7963ddec1342bd41 100644 (file)
--- a/test.py
+++ b/test.py
@@ -39,9 +39,9 @@ class TestHttpRequest(unittest.TestCase):
         body2 = urllib2.urlopen('http://httpbin.org/get').read()
         with vcr.use_cassette(TEST_CASSETTE_FILE):
             self.assertEqual(body1, urllib2.urlopen('http://httpbin.org/').read())
-           self.assertEqual(body2, urllib2.urlopen('http://httpbin.org/get').read())
+            self.assertEqual(body2, urllib2.urlopen('http://httpbin.org/get').read())
             self.assertEqual(body1, urllib2.urlopen('http://httpbin.org/').read())
-           self.assertEqual(body2, urllib2.urlopen('http://httpbin.org/get').read())
+            self.assertEqual(body2, urllib2.urlopen('http://httpbin.org/get').read())
 
 
 class TestHttps(unittest.TestCase):
@@ -70,35 +70,33 @@ class TestHttps(unittest.TestCase):
             self.assertEqual(headers, urllib2.urlopen('https://httpbin.org/').info().items())
 
     def test_get_data(self):
-        TEST_DATA = urlencode({'some':1,'data':'here'})
+        TEST_DATA = urlencode({'some': 1, 'data': 'here'})
         with vcr.use_cassette(TEST_CASSETTE_FILE):
             body = urllib2.urlopen('https://httpbin.org/get?' + TEST_DATA).read()
             self.assertEqual(body, urllib2.urlopen('https://httpbin.org/get?' + TEST_DATA).read())
 
     def test_post_data(self):
-        TEST_DATA = urlencode({'some':1,'data':'here'})
+        TEST_DATA = urlencode({'some': 1, 'data': 'here'})
         with vcr.use_cassette(TEST_CASSETTE_FILE):
-            body = urllib2.urlopen('https://httpbin.org/post',TEST_DATA).read()
-            self.assertEqual(body, urllib2.urlopen('https://httpbin.org/post',TEST_DATA).read())
+            body = urllib2.urlopen('https://httpbin.org/post', TEST_DATA).read()
+            self.assertEqual(body, urllib2.urlopen('https://httpbin.org/post', TEST_DATA).read())
 
     def test_post_unicode(self):
-        TEST_DATA = urlencode({'snowman':u'☃'.encode('utf-8')})
+        TEST_DATA = urlencode({'snowman': u'☃'.encode('utf-8')})
         with vcr.use_cassette(TEST_CASSETTE_FILE):
-            body = urllib2.urlopen('https://httpbin.org/post',TEST_DATA).read()
-            self.assertEqual(body, urllib2.urlopen('https://httpbin.org/post',TEST_DATA).read())
+            body = urllib2.urlopen('https://httpbin.org/post', TEST_DATA).read()
+            self.assertEqual(body, urllib2.urlopen('https://httpbin.org/post', TEST_DATA).read())
+
 
 class TestCassette(unittest.TestCase):
     def test_serialize_cassette(self):
         c1 = Cassette()
-       c1.requests = ['a','b','c']
-       c1.responses = ['d','e','f']
-       ser = c1.serialize()
-       c2 = Cassette(ser)
-       self.assertEqual(c1.requests,c2.requests)
-       self.assertEqual(c1.responses,c2.responses)
-
-
-
+        c1.requests = ['a', 'b', 'c']
+        c1.responses = ['d', 'e', 'f']
+        ser = c1.serialize()
+        c2 = Cassette(ser)
+        self.assertEqual(c1.requests, c2.requests)
+        self.assertEqual(c1.responses, c2.responses)
 
 if __name__ == '__main__':
     unittest.main()
index 894a69f830c299b6fa560fb239476fc7b490cbd2..f22ee355d24a1db1b23e867afda9d0e69a7cd0f7 100644 (file)
@@ -1,4 +1,3 @@
-import socket
 from httplib import HTTPConnection, HTTPSConnection, HTTPMessage
 from cStringIO import StringIO
 from .files import save_cassette, load_cassette
@@ -83,8 +82,8 @@ class VCRHTTPSConnection(HTTPSConnection):
         one.
         """
         HTTPConnection.__init__(self, *args, **kwargs)
-        self.key_file = kwargs.pop('key_file',None)
-        self.cert_file = kwargs.pop('cert_file',None)
+        self.key_file = kwargs.pop('key_file', None)
+        self.cert_file = kwargs.pop('cert_file', None)
         self._cassette = Cassette()
 
     def _load_old_response(self):