Skip to content

Commit 5795549

Browse files
committed
Fix tests
1 parent 9a1e3cf commit 5795549

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

src/sentry/scm/private/providers/gitlab.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,11 +732,22 @@ def map_tree_entry(raw: dict[str, Any]) -> TreeEntry:
732732

733733
def map_review_comment(discussion_id: str) -> Callable[[dict[str, Any]], ReviewComment]:
734734
def _map_review_comment(raw: dict[str, Any]) -> ReviewComment:
735+
author_raw = raw.get("author")
735736
return ReviewComment(
736737
id=f"{discussion_id}:{raw['id']}",
737-
html_url=None,
738-
path=raw["position"]["new_path"],
738+
unique_id=f"{discussion_id}:{raw['id']}",
739+
url=None,
740+
file_path=raw["position"]["new_path"],
739741
body=raw["body"],
742+
author=Author(id=str(author_raw["id"]), username=author_raw["username"])
743+
if author_raw
744+
else None,
745+
created_at=raw.get("created_at"),
746+
diff_hunk=None,
747+
review_id=None,
748+
author_association=None,
749+
commit_sha=None,
750+
head=None,
740751
)
741752

742753
return _map_review_comment

tests/sentry/scm/unit/test_gitlab_provider.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11072,9 +11072,17 @@ class ForwardToClientTest(NamedTuple):
1107211072
provider_return_value={
1107311073
"data": {
1107411074
"id": "c4604a0d82de5427ec0cdc8780c8f810ea9bec86:3149948866",
11075-
"html_url": None,
11076-
"path": "BLAH.md",
11075+
"unique_id": "c4604a0d82de5427ec0cdc8780c8f810ea9bec86:3149948866",
11076+
"url": None,
11077+
"file_path": "BLAH.md",
1107711078
"body": "A review comment, on a file, made by the API on 2026-03-11 11:06:19.945026.",
11079+
"author": {"id": "150871", "username": "jacquev6"},
11080+
"created_at": "2026-03-11T11:06:21.007Z",
11081+
"diff_hunk": None,
11082+
"review_id": None,
11083+
"author_association": None,
11084+
"commit_sha": None,
11085+
"head": None,
1107811086
},
1107911087
"type": "gitlab",
1108011088
"raw": {
@@ -11195,9 +11203,17 @@ class ForwardToClientTest(NamedTuple):
1119511203
provider_return_value={
1119611204
"data": {
1119711205
"id": "c4604a0d82de5427ec0cdc8780c8f810ea9bec86:3149949479",
11198-
"html_url": None,
11199-
"path": "BLAH.md",
11206+
"unique_id": "c4604a0d82de5427ec0cdc8780c8f810ea9bec86:3149949479",
11207+
"url": None,
11208+
"file_path": "BLAH.md",
1120011209
"body": "A reply to the previous comment, made by the API on 2026-03-11 11:06:21.487947.",
11210+
"author": {"id": "150871", "username": "jacquev6"},
11211+
"created_at": "2026-03-11T11:06:31.033Z",
11212+
"diff_hunk": None,
11213+
"review_id": None,
11214+
"author_association": None,
11215+
"commit_sha": None,
11216+
"head": None,
1120111217
},
1120211218
"type": "gitlab",
1120311219
"raw": {

0 commit comments

Comments
 (0)