incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [11/16] git commit: [#5502] ticket:505 Added test for install app method
Date Wed, 18 Dec 2013 21:05:55 GMT
[#5502] ticket:505 Added test for install app method


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

Branch: refs/heads/master
Commit: 8da3f739efb54e51f61fdc85b40f643c461b417e
Parents: 73d89ae
Author: Andriy Sherepa <asherepa@gmail.com>
Authored: Wed Dec 18 12:24:58 2013 +0200
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Dec 18 20:38:58 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_admin.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8da3f739/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 c1f968e..1b526b2 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -24,7 +24,7 @@ from contextlib import contextmanager
 
 import tg
 import PIL
-from nose.tools import assert_equals, assert_in, assert_not_in
+from nose.tools import assert_equals, assert_in, assert_not_in, assert_raises
 from ming.orm.ormsession import ThreadLocalORMSession
 from tg import expose
 from pylons import tmpl_context as c, app_globals as g
@@ -43,6 +43,8 @@ from allura.tests import decorators as td
 from alluratest.controller import TestRestApiBase
 from allura import model as M
 from allura.app import SitemapEntry
+from allura.lib import exceptions
+from allura.lib import helpers as h
 from allura.lib.plugin import AdminExtension
 from allura.ext.admin.admin_main import AdminApp
 from allura.lib.security import has_access
@@ -1111,6 +1113,19 @@ class TestRestInstallTool(TestRestApiBase):
             assert_equals(r.json['success'], False)
             assert_equals(r.json['info'], 'Incorrect mount point name, or mount point already
exists.')
 
+    def test_install_app_limit_exhaust(self):
+        import forgewiki
+        with mock.patch.object(forgewiki.wiki_main.ForgeWikiApp, 'max_instances') as mi:
+            mi.__get__ = mock.Mock(return_value=1)
+
+            data = {
+                'mount_point': 'wiki2',
+                'mount_label': 'wiki2'
+            }
+            # with h.push_config(c, user=M.User.query.get(username='test-admin')):
+            # c.project.install_app('wiki', mount_point='wiki1', mount_label='wiki1', ordinal=0)
+            assert_raises(exceptions.ToolError, c.project.install_app, 'wiki', **data)
+
     def test_tool_installation_limit(self):
         with mock.patch.object(ForgeWikiApp, 'max_instances') as mi:
             mi.__get__ = mock.Mock(return_value=1)


Mime
View raw message