From 528f3126036a657e5283f006aee947e0b23bf6e7 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Thu, 7 Nov 2024 13:13:21 +0200 Subject: [PATCH] Add fields id, status & url for Redmine bug details API: when integration with a 3rd party bug tracker is configured correctly the Bug.details() API method will now return the additional fields `id`, `status` and `url` alongside the existing `description` and `title`! Refs #3748 --- tcms/issuetracker/tests/test_redmine.py | 5 ++++- tcms/issuetracker/types.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tcms/issuetracker/tests/test_redmine.py b/tcms/issuetracker/tests/test_redmine.py index 22fe89b5f4..43f7ee448f 100644 --- a/tcms/issuetracker/tests/test_redmine.py +++ b/tcms/issuetracker/tests/test_redmine.py @@ -57,8 +57,11 @@ def test_bug_id_from_url(self): def test_details_for_url(self): result = self.integration.details(self.existing_bug_url) - self.assertEqual("Hello Redmine", result["title"]) + self.assertEqual(self.existing_bug_id, result["id"]) self.assertEqual("Created via API", result["description"]) + self.assertEqual("OPEN", result["status"]) + self.assertEqual("Hello Redmine", result["title"]) + self.assertEqual(self.existing_bug_url, result["url"]) def test_auto_update_bugtracker(self): issue = self.integration.rpc.issue.get(self.existing_bug_id) diff --git a/tcms/issuetracker/types.py b/tcms/issuetracker/types.py index c4bcb9fdbb..f1aaba8038 100644 --- a/tcms/issuetracker/types.py +++ b/tcms/issuetracker/types.py @@ -358,8 +358,11 @@ def details(self, url): try: issue = self.rpc.issue.get(self.bug_id_from_url(url)) return { - "title": issue.subject, + "id": issue.id, "description": issue.description, + "status": issue.status.name, + "title": issue.subject, + "url": url, } except redminelib.exceptions.ResourceNotFoundError: return super().details(url)