| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,6 +66,10 @@ Change the state of a milestone (activate / close):: | |||
| 66 | 66 | milestone.state_event = 'activate' | |
| 67 | 67 | milestone.save() | |
| 68 | 68 | ||
| 69 | + Promote a project milestone:: | ||
| 70 | + | ||
| 71 | + milestone.promote() | ||
| 72 | + | ||
| 69 | 73 | List the issues related to a milestone:: | |
| 70 | 74 | ||
| 71 | 75 | issues = milestone.issues() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | from gitlab import exceptions as exc | |
| 3 | 3 | from gitlab import types | |
| 4 | 4 | from gitlab.base import RequiredOptional, RESTManager, RESTObject, RESTObjectList | |
| 5 | - from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin | ||
| 5 | + from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, PromoteMixin, SaveMixin | ||
| 6 | 6 | ||
| 7 | 7 | from .issues import GroupIssue, GroupIssueManager, ProjectIssue, ProjectIssueManager | |
| 8 | 8 | from .merge_requests import ( | |
@@ -90,8 +90,9 @@ class GroupMilestoneManager(CRUDMixin, RESTManager): | |||
| 90 | 90 | _types = {"iids": types.ListAttribute} | |
| 91 | 91 | ||
| 92 | 92 | ||
| 93 | - class ProjectMilestone(SaveMixin, ObjectDeleteMixin, RESTObject): | ||
| 93 | + class ProjectMilestone(PromoteMixin, SaveMixin, ObjectDeleteMixin, RESTObject): | ||
| 94 | 94 | _short_print_attr = "title" | |
| 95 | + _update_uses_post = True | ||
| 95 | 96 | ||
| 96 | 97 | @cli.register_custom_action("ProjectMilestone") | |
| 97 | 98 | @exc.on_http_error(exc.GitlabListError) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -199,6 +199,27 @@ def test_project_milestones(project): | |||
| 199 | 199 | assert len(milestone.merge_requests()) == 0 | |
| 200 | 200 | ||
| 201 | 201 | ||
| 202 | + def test_project_milestone_promotion(gl, group): | ||
| 203 | + """ | ||
| 204 | + Milestone promotion requires the project to be a child of a group (not in a user namespace) | ||
| 205 | + | ||
| 206 | + """ | ||
| 207 | + _id = uuid.uuid4().hex | ||
| 208 | + data = { | ||
| 209 | + "name": f"test-project-{_id}", | ||
| 210 | + "namespace_id": group.id, | ||
| 211 | + } | ||
| 212 | + project = gl.projects.create(data) | ||
| 213 | + | ||
| 214 | + milestone_title = "promoteme" | ||
| 215 | + promoted_milestone = project.milestones.create({"title": milestone_title}) | ||
| 216 | + promoted_milestone.promote() | ||
| 217 | + | ||
| 218 | + assert any( | ||
| 219 | + milestone.title == milestone_title for milestone in group.milestones.list() | ||
| 220 | + ) | ||
| 221 | + | ||
| 222 | + | ||
| 202 | 223 | def test_project_pages_domains(gl, project): | |
| 203 | 224 | domain = project.pagesdomains.create({"domain": "foo.domain.com"}) | |
| 204 | 225 | assert len(project.pagesdomains.list()) == 1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments