incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [38/50] git commit: [#3154] ticket:408 clean up export tests
Date Wed, 21 Aug 2013 15:27:20 GMT
[#3154]  ticket:408 clean up export 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/0c71f0a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0c71f0a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0c71f0a8

Branch: refs/heads/db/3154b
Commit: 0c71f0a82442c5d93b7f2ca1372ee60fb03889d7
Parents: dd4700d
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Fri Aug 9 17:12:09 2013 +0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Aug 21 15:25:58 2013 +0000

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py        |  2 +-
 Allura/allura/tests/functional/test_admin.py | 25 +++++++++++++++--------
 2 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0c71f0a8/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 ca55645..0dbc5a5 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -108,7 +108,7 @@ class AdminApp(Application):
         cls = AdminApp
         tools = []
         if cls._exportable_tools is None:
-            for tool in project.ordered_mounts():
+            for tool in project.ordered_mounts(include_hidden=True):
                 if not tool.get('ac'):
                     continue
                 if project.app_instance(tool['ac']).exportable:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0c71f0a8/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 d3a5bd9..6d17263 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -776,8 +776,7 @@ class TestExport(TestController):
         self.setup_with_tools()
 
     @td.with_wiki
-    @td.with_tool('test', 'Tickets', 'bugs', 'Bugs')
-    @td.with_tool('test', 'ShortUrl', 'urls', 'Urls')
+    @td.with_tool('test', 'Wiki', 'wiki2', 'Wiki2')
     def setup_with_tools(self):
         pass
 
@@ -785,7 +784,7 @@ class TestExport(TestController):
         project = M.Project.query.get(shortname='test')
         tools = [t.options.mount_point
                  for t in AdminApp.exportable_tools_for(project)]
-        assert_equals(tools, [u'wiki', u'bugs'])
+        assert_equals(tools, [u'wiki', u'wiki2'])
 
     def test_access(self):
         r = self.app.get('/admin/export',
@@ -804,15 +803,22 @@ class TestExport(TestController):
     def test_export_page_contains_exportable_tools(self):
         r = self.app.get('/admin/export')
         assert_in('Wiki</label> <a href="/p/test/wiki/">/p/test/wiki/</a>',
r)
-        assert_in('Bugs</label> <a href="/p/test/bugs/">/p/test/bugs/</a>',
r)
-        assert_not_in('Urls</label> <a href="/p/test/urls/">/p/test/urls/</a>',
r)
+        assert_in('Wiki2</label> <a href="/p/test/wiki2/">/p/test/wiki2/</a>',
r)
+        assert_not_in('Search</label> <a href="/p/test/search/">/p/test/search/</a>',
r)
+
+    @patch('allura.ext.search.search_main.SearchApp.exportable')
+    def test_export_page_contains_hidden_tools(self, search_app):
+        project = M.Project.query.get(shortname='test')
+        tools = [t.options.mount_point
+                 for t in AdminApp.exportable_tools_for(project)]
+        assert_equals(tools, [u'search', u'wiki', u'wiki2'])
 
     def test_tools_not_selected(self):
         r = self.app.post('/admin/export')
         assert_in('error', self.webflash(r))
 
     def test_bad_tool(self):
-        r = self.app.post('/admin/export', {'tools': u'urls'})
+        r = self.app.post('/admin/export', {'tools': u'search'})
         assert_in('error', self.webflash(r))
 
     @mock.patch('allura.ext.admin.admin_main.export_tasks')
@@ -824,10 +830,10 @@ class TestExport(TestController):
 
     @mock.patch('allura.ext.admin.admin_main.export_tasks')
     def test_selected_multiple_tools(self, export_tasks):
-        r = self.app.post('/admin/export', {'tools': [u'wiki', u'bugs']})
+        r = self.app.post('/admin/export', {'tools': [u'wiki', u'wiki2']})
         assert_in('ok', self.webflash(r))
         export_tasks.bulk_export.post.assert_called_once_with(
-            'test', [u'wiki', u'bugs'], u'test-admin')
+            'test', [u'wiki', u'wiki2'], u'test-admin')
 
     @patch('allura.ext.admin.admin_main.export_tasks')
     def test_export_in_progress(self, export_tasks):
@@ -835,7 +841,8 @@ class TestExport(TestController):
         tmpdir = os.path.join(p.bulk_export_path(), p.shortname)
         shutil.rmtree(p.bulk_export_path(), ignore_errors=True)
         os.makedirs(tmpdir)
-        r = self.app.post('/admin/export', {'tools': [u'wiki', u'bugs']})
+        r = self.app.post('/admin/export', {'tools': [u'wiki', u'wiki2']})
+        r = self.app.post('/admin/export', {'tools': [u'wiki', u'wiki2']})
         assert_in('info', self.webflash(r))
         assert_equals(export_tasks.bulk_export.post.call_count, 0)
         shutil.rmtree(p.bulk_export_path(), ignore_errors=True)


Mime
View raw message