You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/08/10 19:33:18 UTC
[47/50] [abbrv] allura git commit: [#7925] add test for commit view
of a rename
[#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/46baba14
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/46baba14
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/46baba14
Branch: refs/heads/hs/7925
Commit: 46baba14d7286953d72ac10cfa3385746a7b5444
Parents: 5ac9651
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Aug 5 15:30:11 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Aug 10 09:38:38 2015 -0400
----------------------------------------------------------------------
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/46baba14/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/46baba14/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 48969fc..4c363d2 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -820,8 +820,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'
@@ -831,22 +830,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 -> 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):