Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 540E3C457 for ; Mon, 3 Jun 2013 14:39:51 +0000 (UTC) Received: (qmail 13925 invoked by uid 500); 3 Jun 2013 13:37:47 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 13890 invoked by uid 500); 3 Jun 2013 13:37:47 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 13654 invoked by uid 99); 3 Jun 2013 13:37:43 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 13:37:43 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9786C89FC72; Mon, 3 Jun 2013 13:37:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: allura-commits@incubator.apache.org Date: Mon, 03 Jun 2013 13:37:46 -0000 Message-Id: <446a8348ce444f2bb56f2f2f96d52526@git.apache.org> In-Reply-To: <5d7115ad9b314c2b9a7e8591476d9f90@git.apache.org> References: <5d7115ad9b314c2b9a7e8591476d9f90@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [04/21] git commit: [#6235] ticket:352 Test that snapshot contains only tag/branch/trunk if specified [#6235] ticket:352 Test that snapshot contains only tag/branch/trunk if specified Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d01f821a Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d01f821a Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d01f821a Branch: refs/heads/master Commit: d01f821a714074194c01b5dbd2032de32dcf5cd8 Parents: 8e25e0c Author: Igor Bondarenko Authored: Fri May 17 12:30:37 2013 +0000 Committer: Dave Brondsema Committed: Fri May 31 22:14:06 2013 +0000 ---------------------------------------------------------------------- ForgeSVN/forgesvn/tests/model/test_repository.py | 43 +++++++++++++++- 1 files changed, 40 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d01f821a/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 9a22ae1..e131764 100644 --- a/ForgeSVN/forgesvn/tests/model/test_repository.py +++ b/ForgeSVN/forgesvn/tests/model/test_repository.py @@ -313,64 +313,101 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase): @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 + tag_content = ['test-svn-tags-1-tags-tag-1.0/', + 'test-svn-tags-1-tags-tag-1.0/svn-commit.tmp', + 'test-svn-tags-1-tags-tag-1.0/README'] h.set_context('test', 'svn-tags', neighborhood='Projects') tarball_path = '/tmp/tarball/svn/t/te/test/testsvn-trunk-tags-branches/' 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), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), tag_content) os.remove(fn) self.svn_tags.tarball('1', '/tags/tag-1.0/some/path/') assert os.path.isfile(fn), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), tag_content) 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), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), ['test-svn-tags-1-trunk/', + 'test-svn-tags-1-trunk/aaa.txt', + 'test-svn-tags-1-trunk/bbb.txt', + 'test-svn-tags-1-trunk/ccc.txt', + 'test-svn-tags-1-trunk/README']) 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 + branch_content = ['test-svn-tags-1-branches-aaa/', + 'test-svn-tags-1-branches-aaa/aaa.txt', + 'test-svn-tags-1-branches-aaa/svn-commit.tmp', + 'test-svn-tags-1-branches-aaa/README'] h.set_context('test', 'svn-tags', neighborhood='Projects') tarball_path = '/tmp/tarball/svn/t/te/test/testsvn-trunk-tags-branches/' fn = tarball_path + 'test-svn-tags-1-branches-aaa.zip' self.svn_tags.tarball('1', '/branches/aaa/') assert os.path.isfile(fn), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), branch_content) os.remove(fn) self.svn_tags.tarball('1', '/branches/aaa/some/path/') assert os.path.isfile(fn), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), branch_content) 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), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), ['test-svn-tags-1-trunk/', + 'test-svn-tags-1-trunk/aaa.txt', + 'test-svn-tags-1-trunk/bbb.txt', + 'test-svn-tags-1-trunk/ccc.txt', + 'test-svn-tags-1-trunk/README']) 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 + trunk_content = ['test-svn-tags-1-trunk/', + 'test-svn-tags-1-trunk/aaa.txt', + 'test-svn-tags-1-trunk/bbb.txt', + 'test-svn-tags-1-trunk/ccc.txt', + 'test-svn-tags-1-trunk/README'] h.set_context('test', 'svn-tags', neighborhood='Projects') tarball_path = '/tmp/tarball/svn/t/te/test/testsvn-trunk-tags-branches/' fn = tarball_path + 'test-svn-tags-1-trunk.zip' self.svn_tags.tarball('1', '/trunk/') assert os.path.isfile(fn), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), trunk_content) os.remove(fn) self.svn_tags.tarball('1', '/trunk/some/path/') assert os.path.isfile(fn), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), trunk_content) 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), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), trunk_content) 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), fn + snapshot = ZipFile(fn, 'r') + assert_equal(snapshot.namelist(), ['test-src-1/', 'test-src-1/README']) os.remove(fn) def test_is_empty(self):