summaryrefslogtreecommitdiff
path: root/tests/unit/test_gitlab_driver.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-18 01:38:08 +0000
committerGerrit Code Review <review@openstack.org>2022-02-18 01:38:08 +0000
commit596dc1e275591d9c203a753e5b258dd47af70434 (patch)
tree44b539f7728c7471a19bc74bea6f3b057f9981a9 /tests/unit/test_gitlab_driver.py
parent7212df93c5d9ebc199b8a9a07e78090a912ba761 (diff)
parent56865e57d2bb56c49be58cfded6f01c60565f2ef (diff)
downloadzuul-596dc1e275591d9c203a753e5b258dd47af70434.tar.gz
Merge "Add support for adding and removing labels in gitlab"
Diffstat (limited to 'tests/unit/test_gitlab_driver.py')
-rw-r--r--tests/unit/test_gitlab_driver.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/unit/test_gitlab_driver.py b/tests/unit/test_gitlab_driver.py
index 9aa1a6419..15790270f 100644
--- a/tests/unit/test_gitlab_driver.py
+++ b/tests/unit/test_gitlab_driver.py
@@ -195,15 +195,21 @@ class TestGitlabDriver(ZuulTestCase):
A = self.fake_gitlab.openFakeMergeRequest('org/project', 'master', 'A')
self.fake_gitlab.emitEvent(A.getMergeRequestLabeledEvent(
- labels=('label1', 'label2')))
+ add_labels=('label1', 'label2')))
self.waitUntilSettled()
self.assertEqual(0, len(self.history))
self.fake_gitlab.emitEvent(A.getMergeRequestLabeledEvent(
- labels=('gateit', )))
+ add_labels=('gateit', )))
self.waitUntilSettled()
self.assertEqual(1, len(self.history))
+ A.labels = ['verified']
+ self.fake_gitlab.emitEvent(A.getMergeRequestLabeledEvent(
+ remove_labels=('verified', )))
+ self.waitUntilSettled()
+ self.assertEqual(2, len(self.history))
+
@simple_layout('layouts/basic-gitlab.yaml', driver='gitlab')
def test_merge_request_merged(self):
@@ -564,6 +570,18 @@ class TestGitlabDriver(ZuulTestCase):
self.waitUntilSettled()
self.assertEqual(1, len(self.history))
+ @simple_layout('layouts/gitlab-label-add-remove.yaml', driver='gitlab')
+ def test_label_add_remove(self):
+
+ A = self.fake_gitlab.openFakeMergeRequest(
+ 'org/project1', 'master', 'A')
+ A.labels = ['removeme1', 'removeme2']
+
+ self.fake_gitlab.emitEvent(A.getMergeRequestOpenedEvent())
+ self.waitUntilSettled()
+ self.assertEqual(1, len(self.history))
+ self.assertEqual(set(A.labels), {'addme1', 'addme2'})
+
@simple_layout('layouts/merging-gitlab.yaml', driver='gitlab')
def test_merge_action_in_independent(self):