Only create front-end client_id once (#15214)

* Only create frontend client_id once

* Check user and client_id before create refresh token

* Lint

* Follow code review comment

* Minor clenaup

* Update doc string
This commit is contained in:
Jason Hu 2018-07-01 10:36:50 -07:00 committed by Paulus Schoutsen
parent dffe36761d
commit a64a66dd62
5 changed files with 121 additions and 51 deletions

View file

@ -321,7 +321,7 @@ class MockUser(auth.User):
def add_to_auth_manager(self, auth_mgr):
"""Test helper to add entry to hass."""
ensure_auth_manager_loaded(auth_mgr)
auth_mgr._store.users[self.id] = self
auth_mgr._store._users[self.id] = self
return self
@ -329,10 +329,10 @@ class MockUser(auth.User):
def ensure_auth_manager_loaded(auth_mgr):
"""Ensure an auth manager is considered loaded."""
store = auth_mgr._store
if store.clients is None:
store.clients = {}
if store.users is None:
store.users = {}
if store._clients is None:
store._clients = {}
if store._users is None:
store._users = {}
class MockModule(object):