async def test_webhook_returns_error_incorrect_json(webhook_client, create_registrations, caplog):
    'Test that an error is returned when JSON is invalid.'
    resp = (await webhook_client.post('/api/webhook/{}'.format(create_registrations[1]['webhook_id']), data='not json'))
    assert (resp.status == 400)
    json = (await resp.json())
    assert (json == {})
    assert ('invalid JSON' in caplog.text)
Test that an error is returned when JSON is invalid.
async def test_webhook_returns_error_incorrect_json(webhook_client, create_registrations, caplog):
    
    resp = (await webhook_client.post('/api/webhook/{}'.format(create_registrations[1]['webhook_id']), data='not json'))
    assert (resp.status == 400)
    json = (await resp.json())
    assert (json == {})
    assert ('invalid JSON' in caplog.text)