async def test_webhook_handle_decryption(webhook_client, create_registrations):
    'Test that we can encrypt/decrypt properly.'
    key = create_registrations[0]['secret']
    data = encrypt_payload(key, RENDER_TEMPLATE['data'])
    container = {'type': 'render_template', 'encrypted': True, 'encrypted_data': data}
    resp = (await webhook_client.post('/api/webhook/{}'.format(create_registrations[0]['webhook_id']), json=container))
    assert (resp.status == 200)
    webhook_json = (await resp.json())
    assert ('encrypted_data' in webhook_json)
    decrypted_data = decrypt_payload(key, webhook_json['encrypted_data'])
    assert (decrypted_data == {'one': 'Hello world'})
Test that we can encrypt/decrypt properly.
async def test_webhook_handle_decryption(webhook_client, create_registrations):
    
    key = create_registrations[0]['secret']
    data = encrypt_payload(key, RENDER_TEMPLATE['data'])
    container = {'type': 'render_template', 'encrypted': True, 'encrypted_data': data}
    resp = (await webhook_client.post('/api/webhook/{}'.format(create_registrations[0]['webhook_id']), json=container))
    assert (resp.status == 200)
    webhook_json = (await resp.json())
    assert ('encrypted_data' in webhook_json)
    decrypted_data = decrypt_payload(key, webhook_json['encrypted_data'])
    assert (decrypted_data == {'one': 'Hello world'})