You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/08/13 20:06:44 UTC

[17/50] allura git commit: [#7925] Update tests to work with new diff processing

[#7925] Update tests to work with new diff processing


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

Branch: refs/heads/ib/7922
Commit: 04b87c6612c2c1ae4b1dd933e7a7f3734d251228
Parents: 7f738bd
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jul 27 16:08:05 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Mon Aug 10 09:38:35 2015 -0400

----------------------------------------------------------------------
 Allura/allura/tests/model/test_repo.py          |  2 +
 .../forgegit/tests/model/test_repository.py     | 10 ++++
 .../forgesvn/tests/model/test_repository.py     | 59 +++++++++++++-------
 3 files changed, 52 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/04b87c66/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 1f6ec3c..c0a6bc8 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -143,6 +143,8 @@ class TestLastCommit(unittest.TestCase):
         self.repo.paged_diffs.return_value = {
             'added': [],
             'removed': [],
+            'copied': [],
+            'renamed': [],
             'changed': [],
             'total': 0,
         }

http://git-wip-us.apache.org/repos/asf/allura/blob/04b87c66/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 9f007e6..948f228 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -670,6 +670,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             'added': [u'with space.txt', u'привіт.txt'],
             'removed': [],
             'changed': [],
+            'copied': [],
+            'renamed': [],
             'total': 2,
         }
         assert_equals(diffs, expected)
@@ -678,6 +680,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         expected = {
             'added': [],
             'removed': [],
+            'copied': [],
+            'renamed': [],
             'changed': [u'привіт.txt'],
             'total': 1,
         }
@@ -689,6 +693,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
             'added': [u'README.md'],
             'removed': [],
             'changed': [],
+            'copied': [],
+            'renamed': [],
             'total': 1,
         }
         assert_equals(diffs, expected)
@@ -698,6 +704,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         expected = {
             'added': [u'with space.txt'],
             'removed': [],
+            'copied': [],
+            'renamed': [],
             'changed': [],
             'total': 2,
         }
@@ -706,6 +714,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         expected = {
             'added': [u'привіт.txt'],
             'removed': [],
+            'copied': [],
+            'renamed': [],
             'changed': [],
             'total': 2,
         }

http://git-wip-us.apache.org/repos/asf/allura/blob/04b87c66/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 79beb52..9889a60 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -363,7 +363,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         self.assertEqual(entry.diffs, entry.paged_diffs(start=0))
         added_expected = entry.diffs.added[1:3]
         expected = dict(
-            copied=[], changed=[], removed=[],
+            copied=[], changed=[], removed=[], renamed=[],
             added=added_expected, total=4)
         actual = entry.paged_diffs(start=1, end=3)
         self.assertEqual(expected, actual)
@@ -376,7 +376,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         entry = self.repo.commit(self.repo.log(1, id_only=True).next())
         self.assertEqual(
             entry.diffs, dict(
-                copied=[], changed=[],
+                copied=[], changed=[], renamed=[],
                 removed=[], added=['/README'], total=1))
 
     def test_diff_create_path(self):
@@ -385,7 +385,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         actual.added = sorted(actual.added)
         self.assertEqual(
             entry.diffs, dict(
-                copied=[], changed=[], removed=[],
+                copied=[], changed=[], removed=[], renamed=[],
                 added=sorted([
                     '/a', '/a/b', '/a/b/c',
                     '/a/b/c/hello.txt']), total=4))
@@ -394,20 +394,20 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         entry = self.repo.commit(self.repo.log(3, id_only=True).next())
         self.assertEqual(
             entry.diffs, dict(
-                copied=[], changed=['/README'],
+                copied=[], changed=['/README'], renamed=[],
                 removed=[], added=[], total=1))
 
     def test_diff_delete(self):
         entry = self.repo.commit(self.repo.log(4, id_only=True).next())
         self.assertEqual(
             entry.diffs, dict(
-                copied=[], changed=[],
+                copied=[], changed=[], renamed=[],
                 removed=['/a/b/c/hello.txt'], added=[], total=1))
 
     def test_diff_copy(self):
         entry = self.repo.commit(self.repo.log(5, id_only=True).next())
         assert_equals(dict(entry.diffs), dict(
-                copied=[{'new': u'/b', 'old': u'/a', 'diff': '', 'ratio': 1}],
+                copied=[{'new': u'/b', 'old': u'/a', 'diff': '', 'ratio': 1}],  renamed=[],
                 changed=[], removed=[], added=[], total=1))
 
     def test_commit(self):
@@ -1002,6 +1002,8 @@ class TestCommit(_TestWithRepo):
         self.repo._impl.paged_diffs.return_value = {
             'added': ['a', 'a/a', 'a/a/a', 'a/a/b', 'a/b'],
             'changed': [],
+            'copied': [],
+            'renamed': [],
             'removed': [],
             'total': 5,
         }
@@ -1024,6 +1026,8 @@ class TestCommit(_TestWithRepo):
         self._make_log(ci)
         self.repo._impl.paged_diffs.return_value = {
             'added': ['b', 'b/a', 'b/a/a', 'b/a/b', 'b/b'],
+            'renamed': [],
+            'copied': [],
             'changed': [],
             'removed': ['a', 'a/a', 'a/a/a', 'a/a/b', 'a/b'],
             'total': 10,
@@ -1044,25 +1048,38 @@ class TestCommit(_TestWithRepo):
         ci.parent_ids = ['bar']
         self._make_log(ci)
         self.repo._impl.paged_diffs.return_value = {
-            'added': ['b/c', 'b/a/z'],
+            'added': [u'b/c', u'b/a/z'],
+            'removed': [u'/b/a/b', u'b/b'],
             'changed': [],
-            'removed': ['b/a/b', 'b/b', 'b/a/a'],
-            'total': 10,
+            'copied': [
+                {
+                    'new': u'b/c',
+                    'old': u'b/a/b',
+                    'ratio': 1,
+                    'diff': '',
+                },
+                {
+                    'new': u'b/a/z',
+                    'old': u'b/b',
+                    'ratio': 1,
+                    'diff': '',
+                },
+            ],
+            'renamed': [],
+            'total': 2
         }
         M.repo_refresh.refresh_commit_trees(ci, {})
-        assert_equal(ci.diffs.added, [])
+        assert_equal(ci.diffs.added, [u'b/a/z', u'b/c'])
         assert_equal(ci.diffs.changed, [])
-        assert_equal(ci.diffs.removed, ['b/a/a'])
+        assert_equal(ci.diffs.removed, [u'/b/a/b', u'b/b'])
         # see mock for open_blob
         assert_equal(len(ci.diffs.copied), 2)
-        assert_equal(ci.diffs.copied[0]['old'], 'b/a/b')
-        assert_equal(ci.diffs.copied[0]['new'], 'b/c')
-        assert_equal(ci.diffs.copied[0]['ratio'], 1)
-        assert_equal(ci.diffs.copied[0]['diff'], '')
-        assert_equal(ci.diffs.copied[1]['old'], 'b/b')
-        assert_equal(ci.diffs.copied[1]['new'], 'b/a/z')
-        assert ci.diffs.copied[1]['ratio'] < 1, ci.diffs.copied[1]['ratio']
-        assert '+++' in ci.diffs.copied[1]['diff'], ci.diffs.copied[1]['diff']
+        assert_equal(ci.diffs.copied[1]['old'], 'b/a/b')
+        assert_equal(ci.diffs.copied[1]['new'], 'b/c')
+        assert_equal(ci.diffs.copied[1]['ratio'], 1)
+        assert_equal(ci.diffs.copied[1]['diff'], '')
+        assert_equal(ci.diffs.copied[0]['old'], 'b/b')
+        assert_equal(ci.diffs.copied[0]['new'], 'b/a/z')
 
     def test_context(self):
         self.ci.context()
@@ -1132,6 +1149,7 @@ class TestDirectRepoAccess(object):
             'removed': [],
             'changed': [],
             'copied': [],
+            'renamed': [],
             'total': 1,
         }
         assert_equals(diffs, expected)
@@ -1142,6 +1160,7 @@ class TestDirectRepoAccess(object):
             'added': [u'/a', u'/a/b', u'/a/b/c', u'/a/b/c/hello.txt'],
             'removed': [],
             'changed': [],
+            'renamed': [],
             'copied': [],
             'total': 4,
         }
@@ -1152,6 +1171,7 @@ class TestDirectRepoAccess(object):
         expected = {
             'added': [],
             'removed': [],
+            'renamed': [],
             'changed': [u'/README'],
             'copied': [],
             'total': 1,
@@ -1164,6 +1184,7 @@ class TestDirectRepoAccess(object):
             'added': [],
             'removed': ['/a/b/c/hello.txt'],
             'changed': [],
+            'renamed': [],
             'copied': [],
             'total': 1,
         }