def test_index():
    data = json.dumps({})
client = app.test_client()
headers = {'Content-Type': 'application/json'}
response = client.post('/', data=data, headers=headers)
data = json.loads(response.data)
assert data
How do I simulate an AJAX request with Flask test client?