incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [1/3] git commit: [#6344] ticket:379 Test import task posting with empty/non-empty repo
Date Wed, 26 Jun 2013 21:52:18 GMT
Updated Branches:
  refs/heads/master b970970b2 -> 6d2320f7f


[#6344] ticket:379 Test import task posting with empty/non-empty repo


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

Branch: refs/heads/master
Commit: 6d2320f7f349f51ccfe7c98c318fdff204da8e30
Parents: 34ab86f
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Jun 25 09:51:24 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Wed Jun 26 21:51:39 2013 +0000

----------------------------------------------------------------------
 ForgeSVN/forgesvn/svn_main.py                   |  4 +++
 .../tests/functional/test_controllers.py        | 29 +++++++++++++-------
 2 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6d2320f7/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index 73af7b7..de1e0df 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -160,4 +160,8 @@ class SVNImportController(BaseController):
                 c.user, self.app.repo, 'importing',
                 text='''Repository import scheduled,
                         an email notification will be sent when complete.''')
+        else:
+            M.Notification.post_user(
+                c.user, self.app.repo, 'error',
+                text="Can't import into non empty repository.")
         redirect(c.project.url() + 'admin/tools')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6d2320f7/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index cc1d44d..1898435 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -23,6 +23,7 @@ import tg
 import pkg_resources
 from pylons import tmpl_context as c
 from ming.orm import ThreadLocalORMSession
+from mock import patch
 from nose.tools import assert_equal
 from IPython.testing.decorators import onlyif
 
@@ -252,17 +253,25 @@ class TestRootController(SVNTestController):
 
 
 class TestImportController(SVNTestController):
-    def test_index(self):
-        r = self.app.get('/p/test/admin/src/importer').follow(status=200)
-        assert 'You cannot import into a repository that already has commits in it.' in r
 
-
-class TestImportControllerEmptyRepo(TestController):
-    def setUp(self):
-        TestController.setUp(self)
-
-    @with_svn
     def test_index(self):
         r = self.app.get('/p/test/admin/src/importer').follow(status=200)
-        assert 'Be careful! Importing will overwrite current repository contents.' in r
+        assert 'You cannot import into a repository that already has commits in it.' in r
 
+    @patch('forgesvn.svn_main.allura.tasks.repo_tasks')
+    def test_do_import(self, tasks):
+        r = self.app.post('/p/test/admin/src/importer/do_import',
+                          {'checkout_url': 'http://fake.svn/'})
+        assert not tasks.reclone.post.called
+
+    @with_tool('test', 'SVN', 'empty', 'empty SVN')
+    def test_index_empty_repo(self):
+        r = self.app.get('/p/test/admin/empty/importer').follow(status=200)
+        assert 'Enter the URL of the source repository below' in r
+
+    @patch('forgesvn.svn_main.allura.tasks.repo_tasks')
+    @with_tool('test', 'SVN', 'empty', 'empty SVN')
+    def test_do_import_empty_repo(self, tasks):
+        r = self.app.post('/p/test/admin/empty/importer/do_import',
+                          {'checkout_url': 'http://fake.svn/'})
+        assert tasks.reclone.post.called


Mime
View raw message