mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
headers
This commit is contained in:
12
test.py
12
test.py
@@ -15,14 +15,22 @@ class TestHttpRequest(unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def test_response_code(self):
|
def test_response_code(self):
|
||||||
|
code = urllib2.urlopen('http://www.iana.org/domains/example/').getcode()
|
||||||
with vcr.use_cassette(TEST_CASSETTE_FILE):
|
with vcr.use_cassette(TEST_CASSETTE_FILE):
|
||||||
code = urllib2.urlopen('http://www.iana.org/domains/example/').getcode()
|
self.assertEqual(code, urllib2.urlopen('http://www.iana.org/domains/example/').getcode())
|
||||||
self.assertEqual(code, urllib2.urlopen('http://www.iana.org/domains/example/').getcode())
|
self.assertEqual(code, urllib2.urlopen('http://www.iana.org/domains/example/').getcode())
|
||||||
|
|
||||||
def test_response_body(self):
|
def test_response_body(self):
|
||||||
|
body = urllib2.urlopen('http://www.iana.org/domains/example/').read()
|
||||||
with vcr.use_cassette('test/synopsis.yaml'):
|
with vcr.use_cassette('test/synopsis.yaml'):
|
||||||
body = urllib2.urlopen('http://www.iana.org/domains/example/').read()
|
|
||||||
self.assertEqual(body, urllib2.urlopen('http://www.iana.org/domains/example/').read())
|
self.assertEqual(body, urllib2.urlopen('http://www.iana.org/domains/example/').read())
|
||||||
|
self.assertEqual(body, urllib2.urlopen('http://www.iana.org/domains/example/').read())
|
||||||
|
|
||||||
|
def test_response_headers(self):
|
||||||
|
headers = urllib2.urlopen('http://www.iana.org/domains/example/').info()
|
||||||
|
with vcr.use_cassette('test/synopsis.yaml'):
|
||||||
|
self.assertEqual(headers, urllib2.urlopen('http://www.iana.org/domains/example/').info())
|
||||||
|
self.assertEqual(headers, urllib2.urlopen('http://www.iana.org/domains/example/').info())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user