Merge pull request #205 from coreos-inc/delrobot

Fix deletion of robot accounts when attached to builds
This commit is contained in:
Jimmy Zelinskie 2015-07-13 12:19:01 -04:00
commit bde781c98b
2 changed files with 16 additions and 4 deletions

View file

@ -2356,7 +2356,14 @@ class TestOrgRobots(ApiTestCase):
repo = model.get_repository(ORGANIZATION, ORG_REPO)
user = model.get_user(ADMIN_ACCESS_USER)
pull_robot = model.get_user(membername)
model.create_build_trigger(repo, 'fakeservice', 'sometoken', user, pull_robot=pull_robot)
trigger = model.create_build_trigger(repo, 'fakeservice', 'sometoken', user, pull_robot=pull_robot)
# Add a fake build of the fake build trigger.
token = model.create_access_token(repo, 'write', kind='build-worker',
friendly_name='Repository Build Token')
build = model.create_repository_build(repo, token, {}, 'fake-dockerfile', 'fake-name', trigger,
pull_robot_name=membername)
# Add some log entries for the robot.
model.log_action('pull_repo', ORGANIZATION, performer=pull_robot, repository=repo)
@ -2365,6 +2372,9 @@ class TestOrgRobots(ApiTestCase):
self.deleteResponse(OrgRobot,
params=dict(orgname=ORGANIZATION, robot_shortname='bender'))
# Verify the build is still present.
self.assertIsNotNone(model.get_repository_build(build.uuid))
# All the above records should now be deleted, along with the robot. We verify a few of the
# critical ones below.