Commit 41656b9a authored by Meet Mangukiya's avatar Meet Mangukiya

IGitt: Add url property to Issue objects

Closes #50
parent aa28ea30
Pipeline #8938635 passed with stage
in 2 minutes and 9 seconds
......@@ -69,6 +69,14 @@ class GitHubIssue(Issue):
"""
self._data = patch(self._token, self._url, {'title': new_title})
@property
def url(self):
"""
Returns the link/URL of the issue.
"""
return 'https://github.com/{}/issues/{}'.format(self._repository,
self.number)
@property
def number(self) -> int:
"""
......
......@@ -74,6 +74,14 @@ class GitLabIssue(Issue):
"""
self._data = put(self._token, self._url, {'title': new_title})
@property
def url(self):
"""
Returns the link/URL of the issue.
"""
return 'https://gitlab.com/{}/issues/{}'.format(self._repository,
self.number)
@property
def number(self) -> int:
"""
......
......@@ -26,6 +26,13 @@ class Issue:
"""
raise NotImplementedError
@property
def url(self) -> str:
"""
Retrieves the url of the issue.
"""
raise NotImplementedError
@title.setter
def title(self, new_title):
"""
......
......@@ -26,6 +26,10 @@ class GitHubIssueTest(unittest.TestCase):
self.iss.title = 'new title'
self.assertEqual(self.iss.title, 'new title')
def test_url(self):
self.assertEqual(self.iss.url,
'https://github.com/gitmate-test-user/test/issues/39')
def test_assignee(self):
self.assertEqual(self.iss.assignee, None)
......
......@@ -26,6 +26,10 @@ class GitLabIssueTest(unittest.TestCase):
self.iss.title = 'new title'
self.assertEqual(self.iss.title, 'new title')
def test_url(self):
self.assertEqual(self.iss.url,
'https://gitlab.com/gitmate-test-user/test/issues/3')
def test_assignee(self):
self.assertIsNone(self.iss.assignee)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment