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 7D42C10772 for ; Tue, 22 Oct 2013 21:56:47 +0000 (UTC) Received: (qmail 41972 invoked by uid 500); 22 Oct 2013 21:53:34 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 41481 invoked by uid 500); 22 Oct 2013 21:52:38 -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 39784 invoked by uid 99); 22 Oct 2013 21:50:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Oct 2013 21:50:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B5109545CC; Tue, 22 Oct 2013 21:50:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org Date: Tue, 22 Oct 2013 21:50:24 -0000 Message-Id: <6e7f37e4f4d84e6980684ae337b31b5e@git.apache.org> In-Reply-To: <809339d8db6e4b33ad655f9f6d757d71@git.apache.org> References: <809339d8db6e4b33ad655f9f6d757d71@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/50] git commit: remove unnecessary SVN dependency in ForgeImporter tests. git is still required (here, and for github import tests) remove unnecessary SVN dependency in ForgeImporter tests. git is still required (here, and for github import tests) Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e862d32a Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e862d32a Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e862d32a Branch: refs/heads/cj/6422 Commit: e862d32a8d4f9736d86324c4100b9352e2ad345b Parents: 0ee1b91 Author: Dave Brondsema Authored: Tue Oct 15 18:05:56 2013 +0000 Committer: Dave Brondsema Committed: Tue Oct 15 18:05:56 2013 +0000 ---------------------------------------------------------------------- .../forgeimporters/google/tests/test_code.py | 25 ++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e862d32a/ForgeImporters/forgeimporters/google/tests/test_code.py ---------------------------------------------------------------------- diff --git a/ForgeImporters/forgeimporters/google/tests/test_code.py b/ForgeImporters/forgeimporters/google/tests/test_code.py index 5394fda..7c79e36 100644 --- a/ForgeImporters/forgeimporters/google/tests/test_code.py +++ b/ForgeImporters/forgeimporters/google/tests/test_code.py @@ -16,7 +16,7 @@ # under the License. from unittest import TestCase -from mock import Mock, patch +from mock import Mock, patch, MagicMock from ming.odm import ThreadLocalORMSession from allura.tests import TestController @@ -26,7 +26,6 @@ from allura import model as M # important to be distinct from 'test' which ForgeSVN uses, so that the tests can run in parallel and not clobber each other test_project_with_repo = 'test2' -with_svn = with_tool(test_project_with_repo, 'SVN', 'src', 'SVN') from forgeimporters.google.code import ( @@ -88,27 +87,22 @@ class TestGoogleRepoImporter(TestCase): class TestGoogleRepoImportController(TestController, TestCase): - def setUp(self): - """Mount Google Code importer on the SVN admin controller""" - super(TestGoogleRepoImportController, self).setUp() - from forgesvn.svn_main import SVNRepoAdminController - SVNRepoAdminController._importer = GoogleRepoImportController() - @with_svn def test_index(self): - r = self.app.get('/p/{}/admin/src/_importer/'.format(test_project_with_repo)) + r = self.app.get('/p/{}/admin/ext/import/google-code-repo/'.format(test_project_with_repo)) self.assertIsNotNone(r.html.find(attrs=dict(name="gc_project_name"))) self.assertIsNotNone(r.html.find(attrs=dict(name="mount_label"))) self.assertIsNotNone(r.html.find(attrs=dict(name="mount_point"))) - @with_svn + @patch('forgeimporters.google.code.GoogleCodeProjectExtractor') @patch('forgeimporters.base.import_tool') - def test_create(self, import_tool): + def test_create(self, import_tool, extractor): + extractor.return_value.get_repo_type.return_value = 'git' params = dict(gc_project_name='poop', mount_label='mylabel', mount_point='mymount', ) - r = self.app.post('/p/{}/admin/src/_importer/create'.format(test_project_with_repo), + r = self.app.post('/p/{}/admin/ext/import/google-code-repo/create'.format(test_project_with_repo), params, status=302) self.assertEqual(r.location, 'http://localhost/p/{}/admin/'.format(test_project_with_repo)) @@ -116,9 +110,10 @@ class TestGoogleRepoImportController(TestController, TestCase): self.assertEqual(u'mylabel', import_tool.post.call_args[1]['mount_label']) self.assertEqual(u'poop', import_tool.post.call_args[1]['project_name']) - @with_svn + @patch('forgeimporters.google.code.GoogleCodeProjectExtractor') @patch('forgeimporters.base.import_tool') - def test_create_limit(self, import_tool): + def test_create_limit(self, import_tool, extractor): + extractor.return_value.get_repo_type.return_value = 'git' project = M.Project.query.get(shortname=test_project_with_repo) project.set_tool_data('GoogleRepoImporter', pending=1) ThreadLocalORMSession.flush_all() @@ -126,7 +121,7 @@ class TestGoogleRepoImportController(TestController, TestCase): mount_label='mylabel', mount_point='mymount', ) - r = self.app.post('/p/{}/admin/src/_importer/create'.format(test_project_with_repo), + r = self.app.post('/p/{}/admin/ext/import/google-code-repo/create'.format(test_project_with_repo), params, status=302).follow() self.assertIn('Please wait and try again', r)