You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/10/19 00:32:15 UTC

[10/10] git commit: [#3883] Moved some Git- and SVN-related code to respective packages; also minor test fixes.

[#3883] Moved some Git- and SVN-related code to respective packages;
also minor test fixes.

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

Branch: refs/heads/cj/5145
Commit: 044321a8fd71bf6cf40c6ccbfb4951f3e5ba7ca7
Parents: 30c0f47
Author: Peter Hartmann <ma...@gmail.com>
Authored: Fri Aug 10 01:26:27 2012 +0200
Committer: Cory Johns <jo...@geek.net>
Committed: Thu Oct 18 19:24:45 2012 +0000

----------------------------------------------------------------------
 .../allura/ext/admin/templates/project_admin.html  |    4 +-
 Allura/allura/tests/decorators.py                  |   15 ---
 Allura/allura/tests/functional/test_admin.py       |    2 -
 Allura/allura/tests/functional/test_auth.py        |   70 +--------------
 Allura/allura/tests/test_tasks.py                  |   37 --------
 ForgeGit/forgegit/tests/__init__.py                |    6 ++
 ForgeGit/forgegit/tests/functional/test_auth.py    |   67 ++++++++++++++
 .../forgegit/tests/functional/test_controllers.py  |    4 +-
 ForgeGit/forgegit/tests/model/test_repository.py   |    7 +-
 ForgeGit/forgegit/tests/test_git_app.py            |    4 +-
 ForgeGit/forgegit/tests/test_tasks.py              |    4 +-
 ForgeSVN/forgesvn/tests/__init__.py                |    6 ++
 ForgeSVN/forgesvn/tests/functional/test_auth.py    |   37 ++++++++
 .../forgesvn/tests/functional/test_controllers.py  |    5 +-
 ForgeSVN/forgesvn/tests/model/test_repository.py   |   10 ++-
 ForgeSVN/forgesvn/tests/test_svn_app.py            |    4 +-
 ForgeSVN/forgesvn/tests/test_tasks.py              |   51 +++++++++++
 17 files changed, 190 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/Allura/allura/ext/admin/templates/project_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_admin.html b/Allura/allura/ext/admin/templates/project_admin.html
index c579265..9b6473d 100644
--- a/Allura/allura/ext/admin/templates/project_admin.html
+++ b/Allura/allura/ext/admin/templates/project_admin.html
@@ -46,11 +46,11 @@
   </div>
   <div class="grid-13">
     <h3>Code</h3>
-    <p>Git/SVN/Hg will help you keep track of code changes over time. A repository has already been created, checkout, add files and upload code.</p>
+    <p>Source Control Management will help you keep track of code changes over time. A repository has already been created, checkout, add files and upload code.</p>
   </div>
   <div class="grid-4">
     {% for tool in c.project.app_configs %}
-      {% if (tool.tool_name == 'Git' or tool.tool_name == 'Hg' or tool.tool_name == 'SVN') and not code_found %}
+      {% if ('code' in tool.options.mount_point) and not code_found %}
         <a href="{{c.project.url()}}{{tool.options.mount_point}}/fork">Checkout repo</a><br>
         <a href="{{c.project.url()}}{{tool.options.mount_point}}/">View source</a>
         {% set code_found = True %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/Allura/allura/tests/decorators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/decorators.py b/Allura/allura/tests/decorators.py
index 6595979..4c3ce53 100644
--- a/Allura/allura/tests/decorators.py
+++ b/Allura/allura/tests/decorators.py
@@ -50,24 +50,9 @@ with_discussion = with_tool('test', 'Discussion', 'discussion')
 with_link = with_tool('test', 'Link', 'link')
 with_tracker = with_tool('test', 'Tickets', 'bugs')
 with_wiki = with_tool('test', 'Wiki', 'wiki')
-with_git = with_tool('test', 'Git', 'src-git', 'Git', type='git')
 with_hg = with_tool('test', 'Hg', 'src-hg', 'Mercurial', type='hg')
-with_svn = with_tool('test', 'SVN', 'src', 'SVN')
 with_url = with_tool('test', 'ShortUrl', 'url')
 
-
-
-
-def with_repos(func):
-    @wraps(func)
-    @with_git
-    @with_hg
-    @with_svn
-    def wrapped(*args, **kw):
-        return func(*args, **kw)
-    return wrapped
-
-
 class raises(object):
     'test helper in the form of a context manager, to assert that something raises an exception'
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 00b1bf1..bbc879b 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -165,9 +165,7 @@ class TestProjectAdmin(TestController):
         tool_strings = [ ' '.join(opt.find('span').string.strip().split()) for opt in new_ep_opts ]
         expected_tools = [
             'External Link',
-            'Git',
             'Mercurial',
-            'SVN',
             'Wiki',
             'Tickets',
             'Discussion',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 088305a..c84239f 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -292,82 +292,14 @@ class TestAuth(TestController):
         # Make sure that default _lookup() throws 404
         self.app.get('/auth/foobar', status=404)
 
-    @td.with_svn
-    def test_refresh_repo(self):
-        r = self.app.get('/auth/refresh_repo')
-        assert_equal(r.body, 'No repo specified')
-
-        r = self.app.get('/auth/refresh_repo/p/gbalksdfh')
-        assert_equal(r.body, 'No project at /p/gbalksdfh')
-
-        r = self.app.get('/auth/refresh_repo/p/test')
-        assert_equal(r.body, '/p/test does not include a repo mount point')
-
-        r = self.app.get('/auth/refresh_repo/p/test/blah/')
-        assert_equal(r.body, 'Cannot find repo at /p/test/blah')
-
-        r = self.app.get('/auth/refresh_repo/p/test/src/')
-        assert_equal(r.body, '<Repository /tmp/svn/p/test/src> refresh queued.\n')
-
 class TestUserPermissions(TestController):
     allow = dict(allow_read=True, allow_write=True, allow_create=True)
     read = dict(allow_read=True, allow_write=False, allow_create=False)
     disallow = dict(allow_read=False, allow_write=False, allow_create=False)
 
-    def test_unknown_project(self):
-        r = self._check_repo('/git/foo/bar', status=404)
-
-    def test_unknown_app(self):
-        r = self._check_repo('/git/test/bar')
-        assert r == self.disallow, r
-
-    @td.with_svn
-    def test_repo_write(self):
-        r = self._check_repo('/git/test/src.git')
-        assert r == self.allow, r
-        r = self._check_repo('/git/test/src')
-        assert r == self.allow, r
-
-    @td.with_svn
-    def test_subdir(self):
-        r = self._check_repo('/git/test/src.git/foo')
-        assert r == self.allow, r
-        r = self._check_repo('/git/test/src/foo')
-        assert r == self.allow, r
-
-    @td.with_svn
-    def test_neighborhood(self):
-        r = self._check_repo('/git/test.p/src.git')
-        assert r == self.allow, r
-
-    @td.with_svn
-    def test_repo_read(self):
-        r = self._check_repo(
-            '/git/test.p/src.git',
-            username='test-user')
-        assert r == self.read, r
-
-    def test_unknown_user(self):
-        r = self._check_repo(
-            '/git/test.p/src.git',
-            username='test-usera',
-            status=404)
-
-    def _check_repo(self, path, username='test-admin', **kw):
-        url = '/auth/repo_permissions'
-        r = self.app.get(url, params=dict(
-                repo_path=path,
-                username=username), **kw)
-        try:
-            return r.json
-        except:
-            return r
-
-    @td.with_repos
+    @td.with_hg
     def test_list_repos(self):
         r = self.app.get('/auth/repo_permissions', params=dict(username='test-admin'), status=200)
         assert_equal(json.loads(r.body), {"allow_write": [
-            '/git/test/src-git',
             '/hg/test/src-hg',
-            '/svn/test/src',
         ]})

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index 1c52478..05b246b 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -187,43 +187,6 @@ class TestNotificationTasks(unittest.TestCase):
                 assert deliver.called_with('42', '52', 'none')
                 assert fire_ready.called_with()
 
-class TestRepoTasks(unittest.TestCase):
-
-    def setUp(self):
-        setup_basic_test()
-        self.setup_with_tools()
-
-    @td.with_svn
-    def setup_with_tools(self):
-        h.set_context('test', 'src', neighborhood='Projects')
-
-    def test_init(self):
-        ns = M.Notification.query.find().count()
-        with mock.patch.object(c.app.repo, 'init') as f:
-            repo_tasks.init()
-            M.main_orm_session.flush()
-            assert f.called_with()
-            assert ns + 1 == M.Notification.query.find().count()
-
-    def test_clone(self):
-        ns = M.Notification.query.find().count()
-        with mock.patch.object(c.app.repo, 'init_as_clone') as f:
-            with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
-                repo_tasks.clone('foo', 'bar', 'baz')
-                M.main_orm_session.flush()
-                f.assert_called_with('foo', 'bar', 'baz', False)
-                assert ns + 1 == M.Notification.query.find().count()
-
-    def test_refresh(self):
-        with mock.patch.object(c.app.repo, 'refresh') as f:
-            repo_tasks.refresh()
-            f.assert_called_with()
-
-    def test_uninstall(self):
-        with mock.patch.object(shutil, 'rmtree') as f:
-            repo_tasks.uninstall()
-            f.assert_called_with('/tmp/svn/p/test/src', ignore_errors=True)
-
 @event_handler('my_event')
 def _my_event(event_type, testcase, *args, **kwargs):
     testcase.called_with.append((args, kwargs))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeGit/forgegit/tests/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/__init__.py b/ForgeGit/forgegit/tests/__init__.py
index e69de29..98edf4a 100644
--- a/ForgeGit/forgegit/tests/__init__.py
+++ b/ForgeGit/forgegit/tests/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+
+## Make our own Git tool test decorator
+from allura.tests.decorators import with_tool
+
+with_git = with_tool('test', 'Git', 'src-git', 'Git', type='git')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeGit/forgegit/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_auth.py b/ForgeGit/forgegit/tests/functional/test_auth.py
new file mode 100644
index 0000000..275441f
--- /dev/null
+++ b/ForgeGit/forgegit/tests/functional/test_auth.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+import json
+from datadiff.tools import assert_equal
+
+from allura.tests import TestController
+from forgegit.tests import with_git
+
+class TestGitUserPermissions(TestController):
+    allow = dict(allow_read=True, allow_write=True, allow_create=True)
+    read = dict(allow_read=True, allow_write=False, allow_create=False)
+    disallow = dict(allow_read=False, allow_write=False, allow_create=False)
+
+    def test_unknown_project(self):
+        r = self._check_repo('/git/foo/bar', status=404)
+
+    def test_unknown_app(self):
+        r = self._check_repo('/git/test/bar')
+        assert r == self.disallow, r
+
+    @with_git
+    def test_repo_write(self):
+        r = self._check_repo('/git/test/src-git.git')
+        assert r == self.allow, r
+        r = self._check_repo('/git/test/src-git')
+        assert r == self.allow, r
+
+    @with_git
+    def test_subdir(self):
+        r = self._check_repo('/git/test/src-git.git/foo')
+        assert r == self.allow, r
+        r = self._check_repo('/git/test/src-git/foo')
+        assert r == self.allow, r
+
+    @with_git
+    def test_neighborhood(self):
+        r = self._check_repo('/git/test.p/src-git.git')
+        assert r == self.allow, r
+
+    @with_git
+    def test_repo_read(self):
+        r = self._check_repo(
+            '/git/test.p/src-git.git',
+            username='test-user')
+        assert r == self.read, r
+
+    def test_unknown_user(self):
+        r = self._check_repo(
+            '/git/test.p/src-git.git',
+            username='test-usera',
+            status=404)
+
+    def _check_repo(self, path, username='test-admin', **kw):
+        url = '/auth/repo_permissions'
+        r = self.app.get(url, params=dict(
+                repo_path=path,
+                username=username), **kw)
+        try:
+            return r.json
+        except:
+            return r
+
+    @with_git
+    def test_list_repos(self):
+        r = self.app.get('/auth/repo_permissions', params=dict(username='test-admin'), status=200)
+        assert_equal(json.loads(r.body), {"allow_write": [
+            '/git/test/src-git',
+        ]})

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index cf5b986..10f69c3 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -12,8 +12,8 @@ from datadiff.tools import assert_equal
 
 from allura import model as M
 from allura.lib import helpers as h
-from allura.tests import decorators as td
 from alluratest.controller import TestController
+from forgegit.tests import with_git
 
 class _TestCase(TestController):
 
@@ -21,7 +21,7 @@ class _TestCase(TestController):
         super(_TestCase, self).setUp()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     def setup_with_tools(self):
         h.set_context('test', 'src-git', neighborhood='Projects')
         repo_dir = pkg_resources.resource_filename(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 445489f..77b3a4a 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -18,6 +18,7 @@ from allura.tests import decorators as td
 from allura.tests.model.test_repo import RepoImplTestBase
 from allura import model as M
 from forgegit import model as GM
+from forgegit.tests import with_git
 from forgewiki import model as WM
 
 class TestNewGit(unittest.TestCase):
@@ -26,7 +27,7 @@ class TestNewGit(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     @td.with_wiki
     def setup_with_tools(self):
         setup_global_objects()
@@ -99,7 +100,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src-git', neighborhood='Projects')
@@ -221,7 +222,7 @@ class TestGitCommit(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src-git', neighborhood='Projects')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeGit/forgegit/tests/test_git_app.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/test_git_app.py b/ForgeGit/forgegit/tests/test_git_app.py
index df9bbd3..8309420 100644
--- a/ForgeGit/forgegit/tests/test_git_app.py
+++ b/ForgeGit/forgegit/tests/test_git_app.py
@@ -6,7 +6,7 @@ from ming.orm import ThreadLocalORMSession
 
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.lib import helpers as h
-from allura.tests import decorators as td
+from forgegit.tests import with_git
 
 class TestGitApp(unittest.TestCase):
 
@@ -14,7 +14,7 @@ class TestGitApp(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src-git', neighborhood='Projects')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeGit/forgegit/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/test_tasks.py b/ForgeGit/forgegit/tests/test_tasks.py
index f5b40e3..c8e4909 100644
--- a/ForgeGit/forgegit/tests/test_tasks.py
+++ b/ForgeGit/forgegit/tests/test_tasks.py
@@ -5,7 +5,7 @@ from ming.orm import ThreadLocalORMSession
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.lib import helpers as h
 from allura.tasks import repo_tasks
-from allura.tests import decorators as td
+from forgegit.tests import with_git
 
 class TestGitTasks(unittest.TestCase):
 
@@ -13,7 +13,7 @@ class TestGitTasks(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_git
+    @with_git
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src-git', neighborhood='Projects')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeSVN/forgesvn/tests/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/__init__.py b/ForgeSVN/forgesvn/tests/__init__.py
index e69de29..342fe3c 100644
--- a/ForgeSVN/forgesvn/tests/__init__.py
+++ b/ForgeSVN/forgesvn/tests/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+
+## Make our own SVN tool test decorator
+from allura.tests.decorators import with_tool
+
+with_svn = with_tool('test', 'SVN', 'src', 'SVN')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeSVN/forgesvn/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_auth.py b/ForgeSVN/forgesvn/tests/functional/test_auth.py
new file mode 100644
index 0000000..300eee1
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/functional/test_auth.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+import json
+from datadiff.tools import assert_equal
+
+from allura.tests import TestController
+from forgesvn.tests import with_svn
+
+class TestSVNAuth(TestController):
+
+    @with_svn
+    def test_refresh_repo(self):
+        r = self.app.get('/auth/refresh_repo')
+        assert_equal(r.body, 'No repo specified')
+
+        r = self.app.get('/auth/refresh_repo/p/gbalksdfh')
+        assert_equal(r.body, 'No project at /p/gbalksdfh')
+
+        r = self.app.get('/auth/refresh_repo/p/test')
+        assert_equal(r.body, '/p/test does not include a repo mount point')
+
+        r = self.app.get('/auth/refresh_repo/p/test/blah/')
+        assert_equal(r.body, 'Cannot find repo at /p/test/blah')
+
+        r = self.app.get('/auth/refresh_repo/p/test/src/')
+        assert_equal(r.body, '<Repository /tmp/svn/p/test/src> refresh queued.\n')
+
+class TestSVNUserPermissions(TestController):
+    allow = dict(allow_read=True, allow_write=True, allow_create=True)
+    read = dict(allow_read=True, allow_write=False, allow_create=False)
+    disallow = dict(allow_read=False, allow_write=False, allow_create=False)
+
+    @with_svn
+    def test_list_repos(self):
+        r = self.app.get('/auth/repo_permissions', params=dict(username='test-admin'), status=200)
+        assert_equal(json.loads(r.body), {"allow_write": [
+            '/svn/test/src',
+        ]})

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/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 dd88d5e..9c09769 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -8,16 +8,15 @@ from pylons import c
 from ming.orm import ThreadLocalORMSession
 
 from allura.lib import helpers as h
-from allura.tests import decorators as td
 from alluratest.controller import TestController
-
+from forgesvn.tests import with_svn
 
 class SVNTestController(TestController):
     def setUp(self):
         TestController.setUp(self)
         self.setup_with_tools()
 
-    @td.with_svn
+    @with_svn
     def setup_with_tools(self):
         h.set_context('test', 'src', neighborhood='Projects')
         repo_dir = pkg_resources.resource_filename(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/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 94912f9..790c31e 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -7,12 +7,14 @@ import mock
 from ming.orm import ThreadLocalORMSession
 
 from alluratest.controller import setup_basic_test, setup_global_objects
+from allura import model as M
 from allura.lib import helpers as h
 from allura.lib.utils import svn_path_exists
 from allura.tests import decorators as td
 from allura.tests.model.test_repo import RepoImplTestBase
-from allura import model as M
+
 from forgesvn import model as SM
+from forgesvn.tests import with_svn
 
 class TestNewRepo(unittest.TestCase):
 
@@ -20,7 +22,7 @@ class TestNewRepo(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_svn
+    @with_svn
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src', neighborhood='Projects')
@@ -78,7 +80,7 @@ class TestSVNRepo(unittest.TestCase, RepoImplTestBase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_svn
+    @with_svn
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src', neighborhood='Projects')
@@ -243,7 +245,7 @@ class TestSVNRev(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_svn
+    @with_svn
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src', neighborhood='Projects')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeSVN/forgesvn/tests/test_svn_app.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/test_svn_app.py b/ForgeSVN/forgesvn/tests/test_svn_app.py
index 52c884f..1d95039 100644
--- a/ForgeSVN/forgesvn/tests/test_svn_app.py
+++ b/ForgeSVN/forgesvn/tests/test_svn_app.py
@@ -6,7 +6,7 @@ from ming.orm import ThreadLocalORMSession
 
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.lib import helpers as h
-from allura.tests import decorators as td
+from forgesvn.tests import with_svn
 
 class TestSVNApp(unittest.TestCase):
 
@@ -14,7 +14,7 @@ class TestSVNApp(unittest.TestCase):
         setup_basic_test()
         self.setup_with_tools()
 
-    @td.with_svn
+    @with_svn
     def setup_with_tools(self):
         setup_global_objects()
         h.set_context('test', 'src', neighborhood='Projects')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/044321a8/ForgeSVN/forgesvn/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/test_tasks.py b/ForgeSVN/forgesvn/tests/test_tasks.py
new file mode 100644
index 0000000..c3980e9
--- /dev/null
+++ b/ForgeSVN/forgesvn/tests/test_tasks.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+import shutil
+import unittest
+
+import mock
+from pylons import c
+from ming.orm import ThreadLocalORMSession
+
+from alluratest.controller import setup_basic_test, setup_global_objects
+
+from allura import model as M
+from allura.lib import helpers as h
+from allura.tasks import repo_tasks
+
+from forgesvn.tests import with_svn
+
+class TestRepoTasks(unittest.TestCase):
+
+    def setUp(self):
+        setup_basic_test()
+        self.setup_with_tools()
+
+    @with_svn
+    def setup_with_tools(self):
+        h.set_context('test', 'src', neighborhood='Projects')
+
+    def test_init(self):
+        ns = M.Notification.query.find().count()
+        with mock.patch.object(c.app.repo, 'init') as f:
+            repo_tasks.init()
+            M.main_orm_session.flush()
+            assert f.called_with()
+            assert ns + 1 == M.Notification.query.find().count()
+
+    def test_clone(self):
+        ns = M.Notification.query.find().count()
+        with mock.patch.object(c.app.repo, 'init_as_clone') as f:
+            repo_tasks.clone('foo', 'bar', 'baz')
+            M.main_orm_session.flush()
+            f.assert_called_with('foo', 'bar', 'baz')
+            assert ns + 1 == M.Notification.query.find().count()
+
+    def test_refresh(self):
+        with mock.patch.object(c.app.repo, 'refresh') as f:
+            repo_tasks.refresh()
+            f.assert_called_with()
+
+    def test_uninstall(self):
+        with mock.patch.object(shutil, 'rmtree') as f:
+            repo_tasks.uninstall()
+            f.assert_called_with('/tmp/svn/p/test/src', ignore_errors=True)