-
Notifications
You must be signed in to change notification settings - Fork 676
Feat/merge trains additional #2547 #3381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
67bcff1
fb60d42
d753e31
067826b
fb539e9
87674eb
7f8fdce
29c228c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -66,7 +66,7 @@ | |||||
| ProjectApprovalRuleManager, | ||||||
| ) | ||||||
| from .merge_requests import ProjectMergeRequestManager # noqa: F401 | ||||||
| from .merge_trains import ProjectMergeTrainManager # noqa: F401 | ||||||
| from .merge_trains import ProjectMergeTrainManager | ||||||
|
||||||
| from .merge_trains import ProjectMergeTrainManager | |
| from .merge_trains import ProjectMergeTrainManager # noqa: F401 |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,15 +3,17 @@ | |||||||||||
| https://docs.gitlab.com/ee/api/merge_trains.html | ||||||||||||
| """ | ||||||||||||
|
|
||||||||||||
| from copy import deepcopy | ||||||||||||
|
|
||||||||||||
| import pytest | ||||||||||||
| import responses | ||||||||||||
|
|
||||||||||||
| from gitlab.v4.objects import ProjectMergeTrain | ||||||||||||
| from gitlab.v4.objects import ProjectMergeTrain, ProjectMergeTrainMergeRequest | ||||||||||||
|
|
||||||||||||
| mr_content = { | ||||||||||||
| "id": 110, | ||||||||||||
| "merge_request": { | ||||||||||||
| "id": 1, | ||||||||||||
| "id": 273, | ||||||||||||
| "iid": 1, | ||||||||||||
| "project_id": 3, | ||||||||||||
| "title": "Test merge train", | ||||||||||||
|
|
@@ -46,6 +48,10 @@ | |||||||||||
| "duration": 70, | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| merge_train_update = deepcopy(mr_content) | ||||||||||||
| merge_train_update["iid"] = 4 | ||||||||||||
|
||||||||||||
| merge_train_update["iid"] = 4 | |
| merge_train_update["merge_request"]["iid"] = 4 |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The POST fixture for merge_trains/merge_requests/:iid doesn't assert the request body, so the test can pass even if update() sends the wrong payload (or no payload). Consider adding a responses.matchers.json_params_matcher (or equivalent) to validate that the expected fields (e.g., sha) are included in the POST body.
| status=200, | |
| status=200, | |
| match=[ | |
| responses.matchers.json_params_matcher({"sha": "ef33a3zxc3"}), | |
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProjectMergeTrainMergeRequestManager.get(<id>)and.update(<id>)use the merge request IID in the URL, butProjectMergeTrainMergeRequestcurrently uses the default_id_attr = "id"(the merge-train entry id returned by the API). That makesmerge_train_mr.get_id()return a different identifier than what the manager methods expect, which is error-prone for users. Consider overriding_id_attr/get_id()so the object identifier aligns with the merge request IID used by these endpoints (or otherwise make the distinction explicit).