Strip login username in backend (#20150)

* Add modern mode to HA auth provider that strips usernames

* Add tests for async_get_or_create_credentials

* Fix test
This commit is contained in:
Paulus Schoutsen authored and Jason Hu committed 2019-01-16 15:03:05 -08:00
1 parent 9bb7e40ee3
commit 84a2e5d8fb
3 files changed
+245 -61

No files matched your search

@@ -168,10 +168,6 @@ async def test_delete_removes_credential(hass, hass_ws_client,
client = await hass_ws_client(hass, hass_access_token)
user = MockUser().add_to_hass(hass)
user.credentials.append(
await hass.auth.auth_providers[0].async_get_or_create_credentials({
'username': 'test-user'}))
hass_storage[prov_ha.STORAGE_KEY] = {
'version': 1,
'data': {
@@ -181,6 +177,10 @@ async def test_delete_removes_credential(hass, hass_ws_client,
}
}
user.credentials.append(
await hass.auth.auth_providers[0].async_get_or_create_credentials({
'username': 'test-user'}))
await client.send_json({
'id': 5,
'type': auth_ha.WS_TYPE_DELETE,