summaryrefslogtreecommitdiff
path: root/tests/functional/api/test_projects.py
diff options
context:
space:
mode:
authorRaimund Hook <raimund.hook@exfo.com>2021-09-24 10:22:27 +0100
committerRaimund Hook <raimund.hook@exfo.com>2021-10-18 10:30:34 +0100
commit6d7c88a1fe401d271a34df80943634652195b140 (patch)
tree0596d9782a50a60e95d1677c17f9a02428993d1d /tests/functional/api/test_projects.py
parent905781bed2afa33634b27842a42a077a160cffb8 (diff)
downloadgitlab-6d7c88a1fe401d271a34df80943634652195b140.tar.gz
feat(api): add project label promotion
Adds a mixin that allows the /promote endpoint to be called. Signed-off-by: Raimund Hook <raimund.hook@exfo.com>
Diffstat (limited to 'tests/functional/api/test_projects.py')
-rw-r--r--tests/functional/api/test_projects.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/functional/api/test_projects.py b/tests/functional/api/test_projects.py
index ba8e25b..3da9d2b 100644
--- a/tests/functional/api/test_projects.py
+++ b/tests/functional/api/test_projects.py
@@ -1,3 +1,5 @@
+import uuid
+
import pytest
import gitlab
@@ -159,6 +161,28 @@ def test_project_labels(project):
assert len(project.labels.list()) == 0
+def test_project_label_promotion(gl, group):
+ """
+ Label promotion requires the project to be a child of a group (not in a user namespace)
+
+ """
+ _id = uuid.uuid4().hex
+ data = {
+ "name": f"test-project-{_id}",
+ "namespace_id": group.id,
+ }
+ project = gl.projects.create(data)
+
+ label_name = "promoteme"
+ promoted_label = project.labels.create({"name": label_name, "color": "#112233"})
+ promoted_label.promote()
+
+ assert any(label.name == label_name for label in group.labels.list())
+
+ group.labels.delete(label_name)
+ assert not any(label.name == label_name for label in group.labels.list())
+
+
def test_project_milestones(project):
milestone = project.milestones.create({"title": "milestone1"})
assert len(project.milestones.list()) == 1