Commit 50710648 authored by Claude Paroz's avatar Claude Paroz

Fixed commit log URL to depend on branch name

Refs #106.
parent 38236399
......@@ -304,7 +304,7 @@ class Branch(models.Model):
def get_vcs_web_log_url(self):
""" Link to browsable commit log """
if self.module.vcs_type == 'git':
return utils.url_join(self.module.vcs_web, 'commits', 'master')
return utils.url_join(self.module.vcs_web, 'commits', self.name)
else:
# Not implemented for other VCS
return ""
......
......@@ -97,8 +97,21 @@ class ModuleTestCase(TestCase):
self.assertContains(response, "Sorry, no known locations to report bugs for this module.")
def test_branch_methods(self):
self.assertTrue(self.branch.is_head())
self.assertEqual(self.branch.get_vcs_web_url(), "https://gitlab.gnome.org/GNOME/gnome-hello/")
branch = Branch(module=self.mod, name='master')
self.assertTrue(branch.is_head())
self.assertEqual(
branch.get_vcs_web_url(),
"https://gitlab.gnome.org/GNOME/gnome-hello/"
)
self.assertEqual(
branch.get_vcs_web_log_url(),
'https://gitlab.gnome.org/GNOME/gnome-hello/commits/master'
)
branch.name = 'gnome-3-30'
self.assertEqual(
branch.get_vcs_web_log_url(),
'https://gitlab.gnome.org/GNOME/gnome-hello/commits/gnome-3-30'
)
def test_branch_domains(self):
"""
......
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