If registration supports encryption then return encrypted payloads (#21853)

This commit is contained in:
Robbie Trencheny 2019-03-11 05:34:58 -07:00 committed by Charles Garwood
parent c401f35a43
commit 785fd273e3
7 changed files with 91 additions and 24 deletions

View file

@ -56,4 +56,10 @@ async def test_registration(hass_client, authed_api_client): # noqa: F811
assert resp.status == 200
webhook_json = await resp.json()
assert webhook_json == {'rendered': 'Hello world'}
assert 'encrypted_data' in webhook_json
decrypted_data = SecretBox(key).decrypt(webhook_json['encrypted_data'],
encoder=Base64Encoder)
decrypted_data = decrypted_data.decode("utf-8")
assert json.loads(decrypted_data) == {'rendered': 'Hello world'}