Improve test case test_unprotected_branches
We are missing facilities in the github fake to define the protected branches of a repository. Add that and use it to improve the test_unprotected_branches test case. This now additionally protects a branch and triggers a reload to check if the branch is now loaded. Change-Id: I183d4fbe2eddeb1c72fd696d797a75ae93293224
This commit is contained in:
@@ -829,6 +829,21 @@ class TestGithubUnprotectedBranches(ZuulTestCase):
|
||||
# project2 should have no parsed branch
|
||||
self.assertEqual(0, len(tpc2.parsed_branch_config.keys()))
|
||||
|
||||
# now enable branch protection and trigger reload
|
||||
github = self.fake_github.getGithubClient()
|
||||
repo = github.repo_from_project('org/project2')
|
||||
repo._set_branch_protection('master', True)
|
||||
self.sched.reconfigure(self.config)
|
||||
self.waitUntilSettled()
|
||||
|
||||
tenant = self.sched.abide.tenants.get('tenant-one')
|
||||
tpc1 = tenant.project_configs[project1.canonical_name]
|
||||
tpc2 = tenant.project_configs[project2.canonical_name]
|
||||
|
||||
# project1 and project2 should have parsed master now
|
||||
self.assertIn('master', tpc1.parsed_branch_config.keys())
|
||||
self.assertIn('master', tpc2.parsed_branch_config.keys())
|
||||
|
||||
|
||||
class TestGithubWebhook(ZuulTestCase):
|
||||
config_file = 'zuul-github-driver.conf'
|
||||
|
||||
Reference in New Issue
Block a user