From b5576ab6a3e0309cda657f51962776855f0e2081 Mon Sep 17 00:00:00 2001
From: Clement Verna <cverna@tutanota.com>
Date: Mar 13 2018 10:28:10 +0000
Subject: [PATCH 1/3] Assert that git commit details are correctly displayed


Signed-off-by: Clement Verna <cverna@tutanota.com>

---

diff --git a/tests/test_pagure_flask_ui_old_commit.py b/tests/test_pagure_flask_ui_old_commit.py
index 2023094..98b1f47 100644
--- a/tests/test_pagure_flask_ui_old_commit.py
+++ b/tests/test_pagure_flask_ui_old_commit.py
@@ -90,6 +90,10 @@ class PagureFlaskRepoOldUrltests(tests.SimplePagureTest):
             '<span style="background-color: #f0f0f0; padding: 0 5px 0 5px">' +
             ' 3 </span><span style="color: #00A000; background-color: ' +
             '#ddffdd">+ ======</span>' in output.data)
+        self.assertTrue(
+            '<span class="label label-success">+16</span>' in output.data)
+        self.assertTrue('title="View file as of %s"' % commit.oid.hex[0:6]
+                        in output.data)
 
         # View first commit - with the old URL scheme
         output = self.app.get(
@@ -182,6 +186,10 @@ class PagureFlaskRepoOldUrltests(tests.SimplePagureTest):
             '<span style="background-color: #f0f0f0; padding: 0 5px 0 5px"> 3' +
             ' </span><span style="color: #00A000; background-color: #ddffdd">' +
             '+ ======</span>' in output.data)
+        self.assertTrue(
+            '<span class="label label-success">+16</span>' in output.data)
+        self.assertTrue('title="View file as of %s"' % commit.oid.hex[0:6]
+                        in output.data)
 
         # View commit of fork - With the old URL scheme
         output = self.app.get(

From c01836f5f7bc42ffeec58113a3cdc5e94e49df1c Mon Sep 17 00:00:00 2001
From: Clement Verna <cverna@tutanota.com>
Date: Mar 13 2018 10:28:21 +0000
Subject: [PATCH 2/3] Fix flake8 errors


Signed-off-by: Clement Verna <cverna@tutanota.com>

---

diff --git a/tests/test_pagure_flask_ui_old_commit.py b/tests/test_pagure_flask_ui_old_commit.py
index 98b1f47..eb34944 100644
--- a/tests/test_pagure_flask_ui_old_commit.py
+++ b/tests/test_pagure_flask_ui_old_commit.py
@@ -9,26 +9,18 @@
 """
 
 __requires__ = ['SQLAlchemy >= 0.8']
-import pkg_resources
-
-import datetime
-import json
 import unittest
-import shutil
 import sys
-import tempfile
 import os
 
 import pygit2
 from mock import patch
+import pagure.lib
+import tests
 
 sys.path.insert(0, os.path.join(os.path.dirname(
     os.path.abspath(__file__)), '..'))
 
-import pagure.lib
-import tests
-from pagure.lib.repo import PagureRepo
-
 
 class PagureFlaskRepoOldUrltests(tests.SimplePagureTest):
     """ Tests for flask app controller of pagure """
@@ -50,8 +42,7 @@ class PagureFlaskRepoOldUrltests(tests.SimplePagureTest):
 
         # Add a README to the git repo - First commit
         tests.add_readme_git_repo(os.path.join(self.path, 'repos', 'test.git'))
-        repo = pygit2.Repository(os.path.join(self.path, 'repos', 'test.git'))
-        commit = repo.revparse_single('HEAD')
+        pygit2.Repository(os.path.join(self.path, 'repos', 'test.git'))
 
         # View first commit
         output = self.app.get('/apple-touch-icon-152x152-precomposed.png')

From a77f88645d47695ea91143dffe21ad9ef1b4b1b2 Mon Sep 17 00:00:00 2001
From: Clement Verna <cverna@tutanota.com>
Date: Mar 13 2018 10:39:00 +0000
Subject: [PATCH 3/3] Assert that pr commit details are correctly displayed


Signed-off-by: Clement Verna <cverna@tutanota.com>

---

diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py
index 92c3eeb..142ba7c 100644
--- a/tests/test_pagure_flask_ui_fork.py
+++ b/tests/test_pagure_flask_ui_fork.py
@@ -274,6 +274,13 @@ class PagureFlaskForktests(tests.Modeltests):
             'alt="Open changed file" title="Open changed file"></span>'
             '</a>', output.data)
 
+        self.assertIn(
+            '<span class="label label-success '
+            'pull-xs-right text-mono">+3</span>', output.data)
+        self.assertIn(
+            '<span class="label label-danger pull-xs-right">-1</span>',
+            output.data)
+
     @patch('pagure.lib.notify.send_email')
     def test_merge_request_pull_FF(self, send_email):
         """ Test the merge_request_pull endpoint with a FF PR. """

