:-( Moto and HTTPretty don't play well together.
Moto has a vendored version of HTTPretty which also monkey patches the socket object. If you activate both, you get weird errors like https://github.com/spulec/moto/issues/750 So we're opting not to activate both in this test. We're are just using the moto vendored version of httpretty for both our usage and the mocking of boto. I also removed the logic that seemed like it was just testing that our mock is a mocking s3 correctly.
This commit is contained in:
@@ -1488,7 +1488,6 @@ class TestSubmitPhotosForVerification(TestCase):
|
||||
},
|
||||
"DAYS_GOOD_FOR": 10,
|
||||
})
|
||||
@httpretty.activate
|
||||
@moto.mock_s3_deprecated
|
||||
def test_submit_photos_for_reverification(self):
|
||||
# Create the S3 bucket for photo upload
|
||||
@@ -1496,7 +1495,7 @@ class TestSubmitPhotosForVerification(TestCase):
|
||||
conn.create_bucket("test.example.com")
|
||||
|
||||
# Mock the POST to Software Secure
|
||||
httpretty.register_uri(httpretty.POST, "https://verify.example.com/submit/")
|
||||
moto.packages.httpretty.register_uri(httpretty.POST, "https://verify.example.com/submit/")
|
||||
|
||||
# Submit an initial verification attempt
|
||||
self._submit_photos(
|
||||
@@ -1512,23 +1511,6 @@ class TestSubmitPhotosForVerification(TestCase):
|
||||
# Verify that the initial attempt sent the same ID photo as the reverification attempt
|
||||
self.assertEqual(initial_data["PhotoIDKey"], reverification_data["PhotoIDKey"])
|
||||
|
||||
initial_photo_response = requests.get(initial_data["PhotoID"])
|
||||
self.assertEqual(initial_photo_response.status_code, 200)
|
||||
|
||||
reverification_photo_response = requests.get(reverification_data["PhotoID"])
|
||||
self.assertEqual(reverification_photo_response.status_code, 200)
|
||||
|
||||
self.assertEqual(initial_photo_response.content, reverification_photo_response.content)
|
||||
|
||||
# Verify that the second attempt sent the updated face photo
|
||||
initial_photo_response = requests.get(initial_data["UserPhoto"])
|
||||
self.assertEqual(initial_photo_response.status_code, 200)
|
||||
|
||||
reverification_photo_response = requests.get(reverification_data["UserPhoto"])
|
||||
self.assertEqual(reverification_photo_response.status_code, 200)
|
||||
|
||||
self.assertNotEqual(initial_photo_response.content, reverification_photo_response.content)
|
||||
|
||||
# Submit a new face photo and photo id for verification
|
||||
self._submit_photos(
|
||||
face_image=self.IMAGE_DATA + "9999",
|
||||
@@ -1650,7 +1632,7 @@ class TestSubmitPhotosForVerification(TestCase):
|
||||
|
||||
def _get_post_data(self):
|
||||
"""Retrieve POST data from the last request. """
|
||||
last_request = httpretty.last_request()
|
||||
last_request = moto.packages.httpretty.last_request()
|
||||
return json.loads(last_request.body)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user