Aware comments (#15480)

* Make sure we cannot deactivate the owner

* Use different error code when trying to fetch token for inactive user
This commit is contained in:
Paulus Schoutsen 2018-07-15 23:09:05 +02:00 committed by GitHub
parent 5995c6a2ac
commit 864a254071
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View file

@ -291,3 +291,14 @@ async def test_refresh_token_not_requires_client_for_system_user(hass):
token = await manager.async_create_refresh_token(user)
assert token is not None
assert token.client_id is None
async def test_cannot_deactive_owner(mock_hass):
"""Test that we cannot deactive the owner."""
manager = await auth.auth_manager_from_config(mock_hass, [])
owner = MockUser(
is_owner=True,
).add_to_auth_manager(manager)
with pytest.raises(ValueError):
await manager.async_deactivate_user(owner)