Merge pull request #2077 from coreos-inc/entity-search-api-fix
Fix entity search API to not IndexError
This commit is contained in:
commit
8e88fef5e7
2 changed files with 16 additions and 1 deletions
|
@ -514,7 +514,7 @@ def get_matching_users(username_prefix, robot_namespace=None, organization=None,
|
|||
direct_user_query = (direct_user_query | (robot_search & (User.robot == True)))
|
||||
|
||||
query = (User
|
||||
.select(User.username, User.email, User.robot)
|
||||
.select(User.id, User.username, User.email, User.robot)
|
||||
.group_by(User.username, User.email, User.robot)
|
||||
.where(direct_user_query))
|
||||
|
||||
|
|
|
@ -776,6 +776,21 @@ class TestConductSearch(ApiTestCase):
|
|||
|
||||
|
||||
class TestGetMatchingEntities(ApiTestCase):
|
||||
def test_simple_lookup(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
json = self.getJsonResponse(EntitySearch,
|
||||
params=dict(prefix=ADMIN_ACCESS_USER, namespace=ORGANIZATION,
|
||||
includeTeams='true'))
|
||||
self.assertEquals(1, len(json['results']))
|
||||
|
||||
def test_simple_lookup_noorg(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
json = self.getJsonResponse(EntitySearch,
|
||||
params=dict(prefix=ADMIN_ACCESS_USER))
|
||||
self.assertEquals(1, len(json['results']))
|
||||
|
||||
def test_unicode_search(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
||||
|
|
Reference in a new issue