mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 09:35:34 +00:00
This refactoring includes some PEP-8 compliance changes, as well as some more complete testing to ensure that we're in fact serving everything out of cassettes when we thing we are. Incidentally, it also includes fixes for #3 and #4
31 lines
793 B
Python
31 lines
793 B
Python
# coding=utf-8
|
|
|
|
import os
|
|
import json
|
|
import shutil
|
|
import unittest
|
|
|
|
|
|
class TestVCR(unittest.TestCase):
|
|
fixtures = os.path.join('does', 'not', 'exist')
|
|
|
|
def tearDown(self):
|
|
# Remove th urllib2 fixtures if they exist
|
|
if os.path.exists(self.fixtures):
|
|
shutil.rmtree(self.fixtures)
|
|
|
|
def fixture(self, *names):
|
|
'''Return a path to the provided fixture'''
|
|
return os.path.join(self.fixtures, *names)
|
|
|
|
def assertBodiesEqual(self, one, two):
|
|
"""
|
|
httpbin.org returns a different `origin` header
|
|
each time, so strip this out since it makes testing
|
|
difficult.
|
|
"""
|
|
one, two = json.loads(one), json.loads(two)
|
|
del one['origin']
|
|
del two['origin']
|
|
self.assertEqual(one, two)
|