From 8655c13d26485b8bca8ef999793cc4a9fb57b202 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 31 2017 09:17:15 +0000 Subject: Fix branch support for the git blame view We were not precising the branch to view nor were we doing anything with the branch name specified. This commit fixes both points. Fixes https://pagure.io/pagure/issue/2440 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/file.html b/pagure/templates/file.html index 75a9f7a..7130305 100644 --- a/pagure/templates/file.html +++ b/pagure/templates/file.html @@ -145,6 +145,7 @@ repo=repo.name, username=username, namespace=repo.namespace, + identifier=branchname, filename=filename) | unicode }}" title="View git blame">Blame (\w+)\n') - # View in a branch + # View in master branch output = self.app.get('/test/blame/sources') self.assertEqual(output.status_code, 200) self.assertIn(b'', output.data) @@ -2090,6 +2095,21 @@ class PagureFlaskRepotests(tests.Modeltests): b'data-line-number="1">', output.data) self.assertIn( b'', output.data) + data = regex.findall(output.data) + self.assertEqual(len(data), 2) + + # View in feature branch + output = self.app.get('/test/blame/sources?identifier=feature') + self.assertEqual(output.status_code, 200) + self.assertIn(b'
 bar
', output.data) + self.assertIn( + b'', output.data) + self.assertIn( + b'', output.data) + data2 = regex.findall(output.data) + self.assertEqual(len(data2), 2) + self.assertNotEqual(data, data2) # View what's supposed to be an image output = self.app.get('/test/blame/test.jpg')
 bar