incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#4961] Added test for hotcopy guard
Date Thu, 13 Dec 2012 22:08:41 GMT
Updated Branches:
  refs/heads/tv/4961 ab0b66315 -> 50dc76694


[#4961] Added test for hotcopy guard


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

Branch: refs/heads/tv/4961
Commit: 50dc76694b878f84b3d87aff3d8844fcb7e01663
Parents: ab0b663
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Thu Dec 13 22:08:24 2012 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu Dec 13 22:08:24 2012 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/model/svn.py                   |    2 +-
 ForgeSVN/forgesvn/tests/model/test_repository.py |   21 ++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/50dc7669/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 8f74d12..efdc306 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -159,7 +159,7 @@ class SVNImplementation(M.RepositoryImplementation):
                 source_url.startswith('file://')):
             return False
         stdout, stderr = self.check_call(['svn', '--version'])
-        return re.search('version 1.7', stdout):
+        return bool(re.search('version 1.7', stdout))
 
     def check_call(self, cmd):
         p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/50dc7669/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 e7dcfc0..b866488 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -2,7 +2,7 @@ import os
 import shutil
 import unittest
 import pkg_resources
-from itertools import count
+from itertools import count, product
 from datetime import datetime
 
 from pylons import c
@@ -145,6 +145,25 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
 
         shutil.rmtree(dirname)
 
+    @mock.patch('forgesvn.model.svn.tg')
+    def test_can_hotcopy(self, tg):
+        from forgesvn.model.svn import SVNImplementation
+        func = SVNImplementation.can_hotcopy
+        obj = mock.Mock(spec=SVNImplementation)
+        for combo in product(
+                ['file:///myfile', 'http://myfile'],
+                [True, False],
+                ['version 1.7', 'version 1.6']):
+            source_url = combo[0]
+            tg.config = {'scm.svn.hotcopy': combo[1]}
+            stdout = combo[2]
+            obj.check_call.return_value = stdout, ''
+            expected = (source_url.startswith('file://') and
+                    tg.config['scm.svn.hotcopy'] and
+                    stdout == 'version 1.7')
+            result = func(obj, source_url)
+            assert result == expected
+
     @mock.patch('forgesvn.model.svn.g.post_event')
     def test_clone(self, post_event):
         repo = SM.Repository(


Mime
View raw message