incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [04/16] git commit: [#5502] ticket:462 Fixed tests to check properly installed tools
Date Wed, 18 Dec 2013 21:05:48 GMT
[#5502] ticket:462 Fixed tests to check properly installed tools


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

Branch: refs/heads/master
Commit: ce94cc618ed7b9191a5468a59f58cfd6951bc010
Parents: b22c02b
Author: Andriy Sherepa <asherepa@gmail.com>
Authored: Thu Nov 21 14:05:08 2013 +0200
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Dec 18 20:38:57 2013 +0000

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py        |  2 +-
 Allura/allura/tests/functional/test_admin.py | 31 +++++++++++++----------
 2 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ce94cc61/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 314510f..54766d3 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -773,7 +773,7 @@ class ProjectAdminRestController(BaseController):
         tools_names = [t['name'] for t in installable_tools]
         if not tool in tools_names:
             return {'success': False,
-                    'info': 'Incorrect tool name.'
+                    'info': 'Incorrect tool name, or limit is reached.'
                     }
         if not h.re_tool_mount_point.match(mount_point) or c.project.app_instance(mount_point)
is not None:
             return {'success': False,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ce94cc61/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 d4e5192..12dd42b 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -47,6 +47,7 @@ from allura.lib.plugin import AdminExtension
 from allura.ext.admin.admin_main import AdminApp
 from allura.lib.security import has_access
 
+from forgetracker.tracker_main import ForgeTrackerApp
 from forgewiki.model import Page
 
 @contextmanager
@@ -1055,7 +1056,7 @@ class TestRestInstallTool(TestRestApiBase):
         }
         r = self.api_post('/rest/p/test/admin/install_tool/', **data)
         assert_equals(r.json['success'], False)
-        assert_equals(r.json['info'], 'Incorrect tool name.')
+        assert_equals(r.json['info'], 'Incorrect tool name, or limit is reached.')
 
     def test_bad_mount(self):
         r = self.api_get('/rest/p/test/')
@@ -1093,19 +1094,21 @@ class TestRestInstallTool(TestRestApiBase):
         assert_equals(audit_log.message, 'install tool ticketsmount1')
 
     def test_tool_exists(self):
-        r = self.api_get('/rest/p/test/')
-        tools_names = [t['name'] for t in r.json['tools']]
-        assert 'tickets' not in tools_names
-
-        data = {
-            'tool': 'tickets',
-            'mount_point': 'ticketsmount1',
-            'mount_label': 'tickets_label1'
-        }
-        c.project.install_app('tickets', mount_point=data['mount_point'])
-        r = self.api_post('/rest/p/test/admin/install_tool/', **data)
-        assert_equals(r.json['success'], False)
-        assert_equals(r.json['info'], 'Incorrect mount point name, or mount point already
exists.')
+        with mock.patch.object(ForgeTrackerApp, 'max_instances') as mi:
+            mi.__get__ = mock.Mock(return_value=2)
+            r = self.api_get('/rest/p/test/')
+            tools_names = [t['name'] for t in r.json['tools']]
+            assert 'tickets' not in tools_names
+
+            data = {
+                'tool': 'tickets',
+                'mount_point': 'ticketsmount1',
+                'mount_label': 'tickets_label1'
+            }
+            c.project.install_app('tickets', mount_point=data['mount_point'])
+            r = self.api_post('/rest/p/test/admin/install_tool/', **data)
+            assert_equals(r.json['success'], False)
+            assert_equals(r.json['info'], 'Incorrect mount point name, or mount point already
exists.')
 
     def test_unauthorized(self):
         r = self.api_get('/rest/p/test/')


Mime
View raw message