Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_l10nbot_patchets_are_ignored(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
l10n_event = zuul.model.TriggerEvent()
l10n_event.type = 'patchset-created'
l10n_event.account = {'email': 'l10n-bot@translatewiki.net'}
l10n_event.branch = change.branch
self.assertFalse(test_manager.eventMatches(l10n_event, change),
'l10-bot should not enter %s pipeline' %
test_manager.pipeline.name)
def test_recheck_comment_trusted_user(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
event = zuul.model.TriggerEvent()
event.type = 'comment-added'
event.comment = 'Patch Set 1:\n\nrecheck'
event.account = {'email': 'jdoe@wikimedia.org'}
event.branch = change.branch
self.assertTrue(test_manager.eventMatches(event, change))
def test_no_post_on_ref_tag_update(self):
manager = self.getPipeline('post').manager
change = zuul.model.Change('mediawiki/core')
event = zuul.model.TriggerEvent()
event.type = 'ref-updated'
event.ref = 'refs/tags/wmf/1.29.0-wmf.20'
self.assertFalse(manager.eventMatches(event, change))
def test_gated_extension_run_tests_on_feature_branch(self):
repo = 'mediawiki/extensions/CirrusSearch'
release_job = self.getJob(
repo, 'test',
'wmf-quibble-vendor-mysql-php72-docker')
change = zuul.model.Change(repo)
change.branch = 'es6'
self.assertTrue(release_job.changeMatches(change))
def test_recheck_with_inline_comment_removed_review(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
event = zuul.model.TriggerEvent()
event.type = 'comment-added'
event.comment = 'Patch Set 1: -Code-Review\n\n(2 comments)\n\nrecheck'
event.account = {'email': 'jdoe@wikimedia.org'}
event.branch = change.branch
self.assertTrue(test_manager.eventMatches(event, change))
'mediawiki-quibble-composer-mysql-php72-docker': True,
'mediawiki-quibble-vendor-mysql-php74-docker': True,
'mediawiki-quibble-vendor-mysql-php73-docker': True,
'mediawiki-quibble-vendor-mysql-php72-docker': True,
'mediawiki-quibble-composertest-php72-docker': True,
'mediawiki-quibble-apitests-vendor-docker': True,
'mediawiki-quibble-selenium-vendor-docker': True,
'mediawiki-quibble-vendor-sqlite-php72-docker': True,
'mediawiki-quibble-vendor-postgres-php72-docker': True,
'wmf-quibble-vendor-mysql-php72-docker': False,
'wmf-quibble-selenium-php72-docker': True,
'wmf-quibble-core-vendor-mysql-php72-docker': True,
'mwgate-node10-docker': True,
}
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
change.files.extend(['foo.php', 'composer.json'])
job_tree = [t for (p, t) in
self.getPipeline('test').job_trees.iteritems()
if p.name == 'mediawiki/core'][0]
test_jobs = job_tree.getJobs()
job_tree = [t for (p, t) in
self.getPipeline('gate-and-submit').job_trees.iteritems()
if p.name == 'mediawiki/core'][0]
gate_jobs = job_tree.getJobs()
expected_jobs = {
'test': set(expected_test),
'gate-and-submit': set(expected_gate),
}
def test_recheck_with_verified_vote_minus_two(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
event = zuul.model.TriggerEvent()
event.type = 'comment-added'
event.comment = 'Patch Set 1: Verified-2\n\nrecheck'
event.account = {'email': 'jdoe@wikimedia.org'}
event.branch = change.branch
self.assertFalse(test_manager.eventMatches(event, change))
def test_debian_glue_filtered_for_non_debian_changes(self):
job = self.getJob('blubber', 'test', 'debian-glue')
change = zuul.model.Change('blubber')
change.files.extend(['README'])
self.assertFalse(job.changeMatches(change))
def test_pipelines_trustiness(self):
test_manager = self.getPipeline('test').manager
change = zuul.model.Change('mediawiki/core')
change.branch = 'master'
# Untrusted user
untrusted_event = zuul.model.TriggerEvent()
untrusted_event.type = 'patchset-created'
untrusted_event.account = {'email': 'untrusted@example.org'}
untrusted_event.branch = change.branch
self.assertFalse(test_manager.eventMatches(untrusted_event, change))
# Trusted user
trusted_event = zuul.model.TriggerEvent()
trusted_event.type = 'patchset-created'
trusted_event.account = {'email': 'jdoe@wikimedia.org'}
trusted_event.branch = change.branch
self.assertTrue(test_manager.eventMatches(trusted_event, change))