incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [05/31] git commit: [#6235] ticket:352 Basic tests for trunk/tags/branches aware svn
Date Mon, 03 Jun 2013 15:31:58 GMT
[#6235] ticket:352 Basic tests for trunk/tags/branches aware svn


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

Branch: refs/heads/cj/merge-request-4
Commit: 77ae4f6c953885719a760a762b117a7aea62f618
Parents: 67a1021
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri May 17 10:27:17 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri May 31 22:14:04 2013 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/tests/model/test_repository.py |   68 +++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77ae4f6c/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 6026125..c528004 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -44,6 +44,7 @@ from allura.tests.model.test_repo import RepoImplTestBase
 from forgesvn import model as SM
 from forgesvn.model.svn import svn_path_exists
 from forgesvn.tests import with_svn
+from allura.tests.decorators import with_tool
 
 class TestNewRepo(unittest.TestCase):
 
@@ -110,6 +111,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         self.setup_with_tools()
 
     @with_svn
+    @with_tool('test', 'SVN', 'svn-tags', 'SVN with tags')
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src', neighborhood='Projects')
@@ -122,6 +124,13 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
             tool = 'svn',
             status = 'creating')
         self.repo.refresh()
+        self.svn_tags = SM.Repository(
+            name='testsvn-trunk-tags-branches',
+            fs_path=repo_dir,
+            url_path = '/test/',
+            tool = 'svn',
+            status = 'creating')
+        self.svn_tags.refresh()
         ThreadLocalORMSession.flush_all()
         ThreadLocalORMSession.close_all()
 
@@ -302,6 +311,65 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         tarball_zip = ZipFile(os.path.join(tmpdir, 'svn/t/te/test/testsvn/test-src-1.zip'),
'r')
         assert_equal(tarball_zip.namelist(), ['test-src-1/', 'test-src-1/README'])
 
+    @onlyif(os.path.exists(tg.config.get('scm.repos.tarball.zip_binary', '/usr/bin/zip')),
'zip binary is missing')
+    def test_tarball_aware_of_tags(self):
+        # TODO: check zip that it actually contains only needed files
+        tarball_path = '/tmp/tarball/svn/t/te/test/svn-tags/'
+        fn = tarball_path + 'test-svn-tags-1-tags-tag-1.0.zip'
+        self.svn_tags.tarball('1', '/tags/tag-1.0/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        self.svn_tags.tarball('1', '/tags/tag-1.0/some/path/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        # if inside of tags, but no tag is specified
+        # expect snapshot of trunk
+        fn = tarball_path + 'test-svn-tags-1-trunk.zip'
+        self.svn_tags.tarball('1', '/tags/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+
+    @onlyif(os.path.exists(tg.config.get('scm.repos.tarball.zip_binary', '/usr/bin/zip')),
'zip binary is missing')
+    def test_tarball_aware_of_branches(self):
+        # TODO: check zip that it actually contains only needed files
+        tarball_path = '/tmp/tarball/svn/t/te/test/svn-tags/'
+        fn = tarball_path + 'test-svn-tags-1-branches-aaa.zip'
+        self.svn_tags.tarball('1', '/branches/aaa/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        self.svn_tags.tarball('1', '/branches/aaa/some/path/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        # if inside of branches, but no branch is specified
+        # expect snapshot of trunk
+        fn = tarball_path + 'test-svn-tags-1-trunk.zip'
+        self.svn_tags.tarball('1', '/branches/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+
+    @onlyif(os.path.exists(tg.config.get('scm.repos.tarball.zip_binary', '/usr/bin/zip')),
'zip binary is missing')
+    def test_tarball_aware_of_trunk(self):
+        # TODO: check zip that it actually contains only needed files
+        tarball_path = '/tmp/tarball/svn/t/te/test/svn-tags/'
+        fn = tarball_path + 'test-svn-tags-1-trunk.zip'
+        self.svn_tags.tarball('1', '/trunk/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        self.svn_tags.tarball('1', '/trunk/some/path/')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        # no path, but there are trunk in the repo
+        # expect snapshot of trunk
+        self.svn_tags.tarball('1')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+        # no path, and no trunk dir
+        # expect snapshot of repo root
+        fn = '/tmp/tarball/svn/t/te/test/testsvn/test-src-1.zip'
+        self.repo.tarball('1')
+        assert os.path.isfile(fn)
+        os.remove(fn)
+
     def test_is_empty(self):
         assert not self.repo.is_empty()
         with TempDirectory() as d:


Mime
View raw message