Fix missing to_dict and import in robots model

Also adds a test to catch this issue
This commit is contained in:
Joseph Schorr 2017-08-09 20:33:14 -04:00
parent b37885d1e9
commit 854155fe82
3 changed files with 15 additions and 5 deletions

View file

@ -3234,10 +3234,11 @@ class TestUserRobots(ApiTestCase):
class TestOrgRobots(ApiTestCase):
def getRobotNames(self):
def getRobotNames(self, include_permissions=False):
params = dict(orgname=ORGANIZATION, permissions=include_permissions)
return [
r['name']
for r in self.getJsonResponse(OrgRobotList, params=dict(orgname=ORGANIZATION))['robots']
for r in self.getJsonResponse(OrgRobotList, params=params)['robots']
]
def test_create_robot_with_underscores(self):
@ -3256,6 +3257,9 @@ class TestOrgRobots(ApiTestCase):
self.getJsonResponse(OrgRobot, params=dict(orgname=ORGANIZATION, robot_shortname='mr_bender'),
expected_code=200)
# Make sure the robot shows up in the org robots list.
self.assertTrue(membername in self.getRobotNames(include_permissions=True))
def test_delete_robot_after_use(self):
self.login(ADMIN_ACCESS_USER)