Commit ecc89ca6 authored by Meet Mangukiya's avatar Meet Mangukiya

MergeRequests: Override url property

Closes #57
parent ed582a4b
Pipeline #9044367 passed with stage
in 2 minutes and 38 seconds
......@@ -177,6 +177,14 @@ class GitHubMergeRequest(GitHubIssue, MergeRequest):
"""
return self.data['additions'], self.data['deletions']
@property
def url(self):
"""
Returns the link/URL of the issue.
"""
return 'https://github.com/{}/pull/{}'.format(self._repository,
self.number)
def delete(self):
"""
GitHub doesn't allow deleting issues or pull requests.
......
......@@ -32,6 +32,16 @@ class GitLabMergeRequest(GitLabIssue, MergeRequest):
self._url = '/projects/{repo}/merge_requests/{iid}'.format(
repo=quote_plus(repository), iid=self._iid)
@property
def url(self):
"""
Returns the link/URL of the merge request.
"""
return 'https://gitlab.com/{}/merge_requests/{}'.format(
self._repository,
self.number
)
@property
def base_branch_name(self) -> str:
"""
......
......@@ -72,6 +72,10 @@ class TestGitHubMergeRequest(unittest.TestCase):
def test_number(self):
self.assertEqual(self.mr.number, 7)
def test_url(self):
self.assertEqual(self.mr.url,
'https://github.com/gitmate-test-user/test/pull/7')
@my_vcr.use_cassette('tests/GitHub/cassettes/github_merge_request_states.yaml')
def test_change_state(self):
self.mr.close()
......
......@@ -64,6 +64,10 @@ class TestGitLabMergeRequest(unittest.TestCase):
def test_number(self):
self.assertEqual(self.mr.number, 7)
def test_url(self):
self.assertEqual(self.mr.url,
'https://gitlab.com/gitmate-test-user/test/merge_requests/7')
@my_vcr.use_cassette('tests/GitLab/cassettes/gitlab_merge_request_states.yaml')
def test_change_state(self):
self.mr.close()
......
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