Skip to content

Commit

Permalink
Add fields id, status & url for MantisBT bug details
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Nov 8, 2024
1 parent f5bc64b commit 82eb181
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
max-line-length = 100
max-line-length = 102

[pylint]
max-line-length = 102
5 changes: 4 additions & 1 deletion trackers_integration/issuetracker/mantis.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ def details(self, url):
"""
issue = self.rpc.get_issue(self.bug_id_from_url(url))
return {
"title": issue["summary"],
"id": issue["id"],
"description": issue["description"],
"status": issue["status"]["name"],
"title": issue["summary"],
"url": url,
}
15 changes: 10 additions & 5 deletions trackers_integration/tests/test_mantis.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,21 @@ def test_bug_id_from_url(self):
def test_details(self):
result = self.integration.details(self.existing_bug_url)

self.assertEqual("Hello World", result["title"])
self.assertEqual(self.existing_bug_id, result["id"])
self.assertIn("First public bug here", result["description"])
self.assertEqual("new", result["status"])
self.assertEqual("Hello World", result["title"])
self.assertEqual(self.existing_bug_url, result["url"])

def test_details_for_issue_in_private_project(self):
result = self.integration.details(
f"{self.integration.bug_system.base_url}/view.php?id={self.private_issue['id']}"
)
target_url = f"{self.integration.bug_system.base_url}/view.php?id={self.private_issue['id']}"
result = self.integration.details(target_url)

self.assertEqual("Hello Private", result["title"])
self.assertEqual(self.private_issue["id"], result["id"])
self.assertIn("Not everyone can read this", result["description"])
self.assertEqual("new", result["status"])
self.assertEqual("Hello Private", result["title"])
self.assertEqual(target_url, result["url"])

def test_auto_update_bugtracker(self):
initial_comments = self.integration.rpc.get_comments(self.existing_bug_id)
Expand Down

0 comments on commit 82eb181

Please sign in to comment.