Make sure httpretty usage cleans up after itself

This commit is contained in:
bmedx
2017-12-15 14:33:45 -05:00
parent 23503f5226
commit 6ece1708a6
6 changed files with 36 additions and 3 deletions

View File

@@ -484,6 +484,5 @@ class TrackSelectionEmbargoTest(UrlResetMixin, ModuleStoreTestCase):
@httpretty.activate
def test_embargo_allow(self):
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)

View File

@@ -49,6 +49,9 @@ class SamlIntegrationTestUtilities(object):
)
# Mock out HTTP requests that may be made to TestShib:
httpretty.enable()
httpretty.reset()
self.addCleanup(httpretty.reset)
self.addCleanup(httpretty.disable)
def metadata_callback(_request, _uri, headers):
""" Return a cached copy of TestShib's metadata by reading it from disk """
@@ -66,8 +69,6 @@ class SamlIntegrationTestUtilities(object):
content_type='text/xml',
body=cache_duration_metadata_callback
)
self.addCleanup(httpretty.disable)
self.addCleanup(httpretty.reset)
# Configure the SAML library to use the same request ID for every request.
# Doing this and freezing the time allows us to play back recorded request/response pairs