incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [3/17] git commit: [#5145] Test fixes from rebase conflicts
Date Wed, 24 Oct 2012 16:57:17 GMT
[#5145] Test fixes from rebase conflicts

Signed-off-by: Cory Johns <johnsca@geek.net>


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

Branch: refs/heads/cj/5145
Commit: 5dc5275ceacb586957e863922a0a65101d0019e1
Parents: 9c1c0e9
Author: Cory Johns <johnsca@geek.net>
Authored: Thu Oct 18 19:24:07 2012 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Wed Oct 24 16:56:41 2012 +0000

----------------------------------------------------------------------
 .../forgegit/tests/functional/test_controllers.py  |    3 +-
 ForgeGit/forgegit/tests/model/test_repository.py   |    2 +-
 .../forgehg/tests/functional/test_controllers.py   |    2 +-
 ForgeSVN/forgesvn/model/svn.py                     |    2 +-
 ForgeSVN/forgesvn/tests/model/test_repository.py   |   31 +++++++--------
 ForgeSVN/forgesvn/tests/test_tasks.py              |    2 +-
 6 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5dc5275c/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 10f69c3..f3d34e0 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -13,6 +13,7 @@ from datadiff.tools import assert_equal
 from allura import model as M
 from allura.lib import helpers as h
 from alluratest.controller import TestController
+from allura.tests.decorators import with_tool
 from forgegit.tests import with_git
 
 class _TestCase(TestController):
@@ -36,7 +37,7 @@ class _TestCase(TestController):
         ThreadLocalORMSession.flush_all()
         # ThreadLocalORMSession.close_all()
 
-    @td.with_tool('test', 'Git', 'testgit-index', 'Git', type='git')
+    @with_tool('test', 'Git', 'testgit-index', 'Git', type='git')
     def setup_testgit_index_repo(self):
         h.set_context('test', 'testgit-index', neighborhood='Projects')
         repo_dir = pkg_resources.resource_filename(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5dc5275c/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 77b3a4a..910391d 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -266,7 +266,7 @@ class TestGitHtmlView(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src-git', neighborhood='Projects')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5dc5275c/ForgeHg/forgehg/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeHg/forgehg/tests/functional/test_controllers.py b/ForgeHg/forgehg/tests/functional/test_controllers.py
index 2298b1b..2d823b5 100644
--- a/ForgeHg/forgehg/tests/functional/test_controllers.py
+++ b/ForgeHg/forgehg/tests/functional/test_controllers.py
@@ -234,7 +234,7 @@ class TestTreeLs(TestController):
         TestController.setUp(self)
         self.setup_with_tools()
 
-    @td.with_hg
+    @with_hg
     def setup_with_tools(self):
         h.set_context('test', 'src-hg', neighborhood='Projects')
         repo_dir = pkg_resources.resource_filename(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5dc5275c/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 8f6d465..c5f5d55 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -64,7 +64,7 @@ class Repository(M.Repository):
     def count_revisions(self, ci):
         # since SVN histories are inherently linear and the commit _id
         # contains the revision, just parse it out from there
-        return int(ci._id.split(':')[1])
+        return int(self._impl._revno(ci._id))
 
     def log(self, branch='HEAD', offset=0, limit=10):
         return list(self._log(branch, offset, limit))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5dc5275c/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 488e441..ac589e3 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -7,6 +7,7 @@ from datetime import datetime
 
 from pylons import c
 import mock
+from nose.tools import assert_equal
 import tg
 import ming
 from ming.base import Object
@@ -392,15 +393,20 @@ class TestRepo(_TestWithRepo):
         assert self.repo.upstream_repo.url == 'srcurl'
         assert self.repo._impl.clone_from.called_with('srcpath')
 
-    def test_log(self):
-        ci = mock.Mock()
-        ci.log = mock.Mock(return_value=[1,2,3])
-        self.repo._impl.commit = mock.Mock(return_value=ci)
-        assert self.repo.log() == [1,2,3], self.repo.log()
+    @mock.patch.object(M.repo.CommitRunDoc.m, 'get')
+    def test_log(self, crd):
+        head = mock.Mock(name='commit_head', _id=3)
+        commits = dict([(i, mock.Mock(name='commit_%s'%i, _id=i)) for i in range(3)])
+        commits[3] = head
+        head.query.get = lambda _id: commits[_id]
+        self.repo._impl.commit = mock.Mock(return_value=head)
+        crd.return_value = mock.Mock(commit_ids=[3, 2, 1, 0], commit_times=[4, 3, 2, 1],
parent_commit_ids=[])
+        log = self.repo.log()
+        assert_equal([c._id for c in log], [3, 2, 1, 0])
 
     def test_count_revisions(self):
         ci = mock.Mock()
-        ci.count_revisions = mock.Mock(return_value=42)
+        self.repo.count_revisions = mock.Mock(return_value=42)
         self.repo._impl.commit = mock.Mock(return_value=ci)
         assert self.repo.count() == 42
 
@@ -441,9 +447,9 @@ class TestRepo(_TestWithRepo):
 
     def test_refresh(self):
         ci = mock.Mock()
-        ci.count_revisions=mock.Mock(return_value=100)
         ci.authored.name = 'Test Committer'
         ci.author_url = '/u/test-committer/'
+        self.repo.count_revisions=mock.Mock(return_value=100)
         self.repo._impl.commit = mock.Mock(return_value=ci)
         self.repo._impl.new_commits = mock.Mock(return_value=['foo%d' % i for i in range(100)
])
         self.repo._impl.all_commit_ids = mock.Mock(return_value=['foo%d' % i for i in range(100)
])
@@ -475,7 +481,7 @@ class TestRepo(_TestWithRepo):
 
     def test_refresh_private(self):
         ci = mock.Mock()
-        ci.count_revisions=mock.Mock(return_value=100)
+        self.repo.count_revisions=mock.Mock(return_value=100)
         self.repo._impl.commit = mock.Mock(return_value=ci)
         self.repo._impl.new_commits = mock.Mock(return_value=['foo%d' % i for i in range(100)
])
         def set_heads():
@@ -610,18 +616,11 @@ class TestCommit(_TestWithRepo):
         x = self.ci.get_path('a/a')
         assert isinstance(x, M.repo.Tree)
 
-    def test_log(self):
-        rb = M.repo_refresh.CommitRunBuilder(['foo'])
-        rb.run()
-        rb.cleanup()
-        commits = self.ci.log(0, 100)
-        assert commits[0]._id == 'foo'
-
     def test_count_revisions(self):
         rb = M.repo_refresh.CommitRunBuilder(['foo'])
         rb.run()
         rb.cleanup()
-        assert self.ci.count_revisions() == 1
+        assert self.repo.count_revisions(self.ci) == 1
 
     def test_compute_diffs(self):
         self.repo._impl.commit = mock.Mock(return_value=self.ci)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5dc5275c/ForgeSVN/forgesvn/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/test_tasks.py b/ForgeSVN/forgesvn/tests/test_tasks.py
index c3173a4..1a6a5f6 100644
--- a/ForgeSVN/forgesvn/tests/test_tasks.py
+++ b/ForgeSVN/forgesvn/tests/test_tasks.py
@@ -46,7 +46,7 @@ class TestRepoTasks(unittest.TestCase):
         with mock.patch.object(c.app.repo, 'init_as_clone') as f:
             repo_tasks.clone('foo', 'bar', 'baz')
             M.main_orm_session.flush()
-            f.assert_called_with('foo', 'bar', 'baz')
+            f.assert_called_with('foo', 'bar', 'baz', False)
             assert ns + 1 == M.Notification.query.find().count()
 
     def test_refresh(self):


Mime
View raw message