You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/12/18 23:10:48 UTC
[5/6] git commit: [#6821] Fixed failing tests due to last commit
refactor
[#6821] Fixed failing tests due to last commit refactor
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/79df9b71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/79df9b71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/79df9b71
Branch: refs/heads/master
Commit: 79df9b717e34c7a566ab9214c32b384f0d66388a
Parents: fd23eda
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Dec 18 19:10:40 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Dec 18 22:10:34 2013 +0000
----------------------------------------------------------------------
Allura/allura/tests/model/test_repo.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/79df9b71/Allura/allura/tests/model/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index ef39e4b..edc76b2 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -103,6 +103,10 @@ class TestLastCommit(unittest.TestCase):
self.repo.shorthand_for_commit = lambda _id: _id[:6]
self.repo.rev_to_commit_id = lambda rev: rev
self.repo.log = self._log
+ self._changes = defaultdict(list)
+ self.repo.get_changes = lambda _id: self._changes[_id]
+ self._last_commits = [(None, set())]
+ self.repo._get_last_commit = lambda i, p: self._last_commits.pop()
lcids = M.repository.RepositoryImplementation.last_commit_ids.__func__
self.repo.last_commit_ids = lambda *a, **k: lcids(self.repo, *a, **k)
c.lcid_cache = {}
@@ -151,12 +155,9 @@ class TestLastCommit(unittest.TestCase):
)
commit.tree = self._build_tree(commit, '/', tree_paths)
commit.get_tree = lambda c: commit.tree
- diffinfo = M.repo.DiffInfoDoc(dict(
- _id=commit._id,
- differences=[{'name': p} for p in diff_paths or tree_paths],
- ))
- diffinfo.m.save()
+ self._changes[commit._id].extend(diff_paths or tree_paths)
self.repo._commits[commit._id] = commit
+ self._last_commits.append((commit._id, set(diff_paths or tree_paths)))
return commit
def _log(self, revs, path, id_only=True):
@@ -344,7 +345,7 @@ class TestLastCommit(unittest.TestCase):
self.assertEqual(self.repo._commits[lcd.commit_id].message, commit3.message)
self.assertEqual(lcd.commit_id, commit3._id)
self.assertEqual(lcd.path, '')
- self.assertEqual(len(lcd.entries), 2)
+ self.assertEqual(len(lcd.entries), 3)
self.assertEqual(lcd.by_name['dir1'], commit2._id)
self.assertEqual(lcd.by_name['file2'], commit3._id)