allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [12/12] allura git commit: [#7925] add test for commit view of a rename
Date Wed, 05 Aug 2015 15:31:22 GMT
[#7925] add test for commit view of a rename


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c72af7e8
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c72af7e8
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c72af7e8

Branch: refs/heads/db/7925
Commit: c72af7e84906c88a989a3ba7334fd9eaa38741c0
Parents: cfdea6b
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Wed Aug 5 15:30:11 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Aug 5 15:30:33 2015 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py             |  1 -
 .../tests/functional/test_controllers.py        | 29 ++++++++++++++------
 2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c72af7e8/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 8849a40..318f81f 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -675,7 +675,6 @@ class GitImplementation(M.RepositoryImplementation):
         while x < len(cmd_output):
             status = cmd_output[x][0]
             if status in ('R', 'C'):
-                # TODO: make sure we have a test for this
                 ratio = float(cmd_output[x][1:4]) / 100.0
                 files.append((status, {
                     'new': h.really_unicode(cmd_output[x + 2]),

http://git-wip-us.apache.org/repos/asf/allura/blob/c72af7e8/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 7f6bf88..f8804e5 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -828,8 +828,7 @@ class TestGitRename(TestController):
     @with_git
     def setup_with_tools(self):
         h.set_context('test', 'src-git', neighborhood='Projects')
-        repo_dir = pkg_resources.resource_filename(
-            'forgegit', 'tests/data')
+        repo_dir = pkg_resources.resource_filename('forgegit', 'tests/data')
         c.app.repo.fs_path = repo_dir
         c.app.repo.status = 'ready'
         c.app.repo.name = 'testrename.git'
@@ -839,22 +838,36 @@ class TestGitRename(TestController):
         ThreadLocalORMSession.flush_all()
 
     def test_log(self):
-        resp = self.app.get(
-            '/src-git/ci/259c77dd6ee0e6091d11e429b56c44ccbf1e64a3/log/?path=/f2.txt')
+        # commit after the rename
+        resp = self.app.get('/src-git/ci/259c77dd6ee0e6091d11e429b56c44ccbf1e64a3/log/?path=/f2.txt')
         assert '<b>renamed from</b>' in resp
         assert '/f.txt' in resp
         assert '(27 Bytes)' in resp
         assert '(19 Bytes)' in resp
 
-        resp = self.app.get(
-            '/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/log/?path=/f.txt')
+        # commit before the rename
+        resp = self.app.get('/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/log/?path=/f.txt')
         assert '(19 Bytes)' in resp
         assert '(10 Bytes)' in resp
 
-        resp = self.app.get(
-            '/src-git/ci/7c09182e61af959e4f1fb0e354bab49f14ef810d/tree/f.txt')
+        # first commit, adding the file
+        resp = self.app.get('/src-git/ci/7c09182e61af959e4f1fb0e354bab49f14ef810d/tree/f.txt')
         assert "2 lines (1 with data), 10 Bytes" in resp
 
+    def test_commit(self):
+        # get the rename commit itself
+        resp = self.app.get('/src-git/ci/b120505a61225e6c14bee3e5b5862db81628c35c/')
+
+        # the top portion of the output
+        assert "<td>renamed" in resp
+        assert "f.txt -&gt; f2.txt" in resp
+
+        # the diff portion of the output
+        resp_no_ws = re.sub(r'\s+', '', str(resp))
+        assert '<a href="/p/test/src-git/ci/fbb0644603bb6ecee3ebb62efe8c86efc9b84ee6/tree/f.txt">f.txt</a>to<a
href="/p/test/src-git/ci/b120505a61225e6c14bee3e5b5862db81628c35c/tree/f2.txt">f2.txt</a>'.replace('
','') \
+               in resp_no_ws
+        assert '<span class="empty-diff">File was renamed.</span>' in resp
+
 
 class TestGitBranch(TestController):
     def setUp(self):


Mime
View raw message