I have code within a Flask application that uses JSONs in the request, and I can get the JSON object like so:
Request = request.get_json()
Changing the post to
response=self.app.post('/test_function', data=json.dumps(dict(foo='bar')), content_type='application/json')
fixed it.
Thanks to user3012759.