Fix GitHub branch protection test

The fixed test had a misleading name and it didn't really create
an additional branch as it was intended by setting the branch
protection on a non-existing branch.

Change-Id: I03256e890b2d77c2a88fe27f9698fd5e5d5156d5
This commit is contained in:
Markus Hosch 2018-07-09 10:40:55 +02:00
parent d7b835debb
commit d64cb1e10a
1 changed files with 9 additions and 6 deletions

View File

@ -915,17 +915,20 @@ class TestGithubUnprotectedBranches(ZuulTestCase):
# We now expect that zuul reconfigured itself
self.assertLess(old, new)
def test_unprotected_branch_delete(self):
def test_protected_branch_delete(self):
"""Test that protected branch deletes trigger a tenant reconfig"""
# Prepare repo with an initial commit
# Prepare repo with an initial commit and enable branch protection
github = self.fake_github.getGithubClient()
repo = github.repo_from_project('org/project2')
repo._set_branch_protection('master', True)
A = self.fake_github.openFakePullRequest('org/project2', 'master', 'A')
A.setMerged("merging A")
# now enable branch protection and trigger a reconfiguration
github = self.fake_github.getGithubClient()
repo = github.repo_from_project('org/project2')
repo._set_branch_protection('feat-x', True)
# add a spare branch so that the project is not empty after master gets
# deleted.
repo._create_branch('feat-x')
self.sched.reconfigure(self.config)
self.waitUntilSettled()