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/6686
Commit: e862d32a8d4f9736d86324c4100b9352e2ad345b
Parents: 0ee1b91
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Tue Oct 15 18:05:56 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
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)
|