Only return the team and repo permissions when listing robots when we absolutely need them.

This commit is contained in:
Joseph Schorr 2015-05-08 16:43:07 -04:00
parent 561f2c7db0
commit f858caf6cd
4 changed files with 81 additions and 34 deletions

View file

@ -2173,6 +2173,31 @@ class TestUserRobots(ApiTestCase):
def getRobotNames(self):
return [r['name'] for r in self.getJsonResponse(UserRobotList)['robots']]
def test_robot_list(self):
self.login(NO_ACCESS_USER)
# Create some robots.
self.putJsonResponse(UserRobot,
params=dict(robot_shortname='bender'),
expected_code=201)
self.putJsonResponse(UserRobot,
params=dict(robot_shortname='goldy'),
expected_code=201)
self.putJsonResponse(UserRobot,
params=dict(robot_shortname='coolbot'),
expected_code=201)
# Queries: Base + the list query
with assert_query_count(BASE_ACCESS_QUERY_COUNT + 1):
self.getJsonResponse(UserRobotList)
# Queries: Base + the list query
with assert_query_count(BASE_ACCESS_QUERY_COUNT + 1):
self.getJsonResponse(UserRobotList, params=dict(permissions=True))
def test_robots(self):
self.login(NO_ACCESS_USER)