Merge "Fix github branch protection while already unprotected"
This commit is contained in:
commit
47f63fbba1
|
@ -220,8 +220,9 @@ class FakeRepository(object):
|
|||
|
||||
def _set_branch_protection(self, branch_name, protected=True,
|
||||
contexts=None):
|
||||
if not protected and branch_name in self._branch_protection_rules:
|
||||
del self._branch_protection_rules[branch_name]
|
||||
if not protected:
|
||||
if branch_name in self._branch_protection_rules:
|
||||
del self._branch_protection_rules[branch_name]
|
||||
return
|
||||
|
||||
rule = self._branch_protection_rules[branch_name]
|
||||
|
|
|
@ -1011,6 +1011,7 @@ class TestGithubDriver(ZuulTestCase):
|
|||
github = self.fake_github.getGithubClient()
|
||||
repo = github.repo_from_project(project)
|
||||
repo._create_branch(branch)
|
||||
repo._set_branch_protection(branch, False)
|
||||
|
||||
self.fake_github.emitEvent(
|
||||
self.fake_github.getPushEvent(
|
||||
|
@ -1113,6 +1114,7 @@ class TestGithubDriver(ZuulTestCase):
|
|||
github = self.fake_github.getGithubClient()
|
||||
repo = github.repo_from_project(project)
|
||||
repo._create_branch(branch)
|
||||
repo._set_branch_protection(branch, False)
|
||||
|
||||
A = self.fake_github.openFakePullRequest(project, branch, 'A')
|
||||
old_sha = A.head_sha
|
||||
|
@ -1569,6 +1571,7 @@ class TestGithubUnprotectedBranches(ZuulTestCase):
|
|||
github = self.fake_github.getGithubClient()
|
||||
repo = github.repo_from_project(project)
|
||||
repo._create_branch(branch)
|
||||
repo._set_branch_protection(branch, False)
|
||||
|
||||
self.fake_github.emitEvent(
|
||||
self.fake_github.getPushEvent(
|
||||
|
|
Loading…
Reference in New Issue