Fix build by pre-calling the caches

They were being called in a test-dependent order, which caused any tests which relied on query count to fail
This commit is contained in:
Joseph Schorr 2017-06-27 18:11:46 +03:00
parent cdd7cb9321
commit 8dcea30d58
3 changed files with 23 additions and 14 deletions

View file

@ -54,9 +54,13 @@ def get_public_repo_visibility():
return Visibility.get(name='public')
@lru_cache(maxsize=3)
def _lookup_team_role(name):
return TeamRole.get(name=name)
return _lookup_team_roles()[name]
@lru_cache(maxsize=1)
def _lookup_team_roles():
return {role.name:role for role in TeamRole.select()}
def filter_to_repos_for_user(query, username=None, namespace=None, repo_kind='image',