incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [07/17] git commit: [#6692] Split bulk export REST API test cases up better
Date Thu, 31 Oct 2013 22:05:02 GMT
[#6692] Split bulk export REST API test cases up better

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/master
Commit: 56144183e50b3ab55c97f65a8191c66887ab7dd0
Parents: b1986d7
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Oct 4 21:22:07 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu Oct 31 18:41:02 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56144183/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 4d3efb5..191d903 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -982,12 +982,17 @@ class TestRestExport(TestRestApiBase):
     @mock.patch('allura.model.project.MonQTask')
     @mock.patch('allura.ext.admin.admin_main.AdminApp.exportable_tools_for')
     @mock.patch('allura.ext.admin.admin_main.export_tasks.bulk_export')
-    def test_export(self, bulk_export, exportable_tools, MonQTask):
+    def test_export_no_exportable_tools(self, bulk_export, exportable_tools, MonQTask):
         MonQTask.query.get.return_value = None
         exportable_tools.return_value = []
         r = self.api_post('/rest/p/test/admin/export', tools='tickets, discussion', status=400)
         assert_equals(bulk_export.post.call_count, 0)
 
+    @mock.patch('allura.model.project.MonQTask')
+    @mock.patch('allura.ext.admin.admin_main.AdminApp.exportable_tools_for')
+    @mock.patch('allura.ext.admin.admin_main.export_tasks.bulk_export')
+    def test_export_no_tools_specified(self, bulk_export, exportable_tools, MonQTask):
+        MonQTask.query.get.return_value = None
         exportable_tools.return_value = [
                 mock.Mock(options=mock.Mock(mount_point='tickets')),
                 mock.Mock(options=mock.Mock(mount_point='discussion')),
@@ -995,11 +1000,27 @@ class TestRestExport(TestRestApiBase):
         r = self.api_post('/rest/p/test/admin/export', status=400)
         assert_equals(bulk_export.post.call_count, 0)
 
+    @mock.patch('allura.model.project.MonQTask')
+    @mock.patch('allura.ext.admin.admin_main.AdminApp.exportable_tools_for')
+    @mock.patch('allura.ext.admin.admin_main.export_tasks.bulk_export')
+    def test_export_busy(self, bulk_export, exportable_tools, MonQTask):
         MonQTask.query.get.return_value = 'something'
+        exportable_tools.return_value = [
+                mock.Mock(options=mock.Mock(mount_point='tickets')),
+                mock.Mock(options=mock.Mock(mount_point='discussion')),
+            ]
         r = self.api_post('/rest/p/test/admin/export', tools='tickets, discussion', status=503)
         assert_equals(bulk_export.post.call_count, 0)
 
+    @mock.patch('allura.model.project.MonQTask')
+    @mock.patch('allura.ext.admin.admin_main.AdminApp.exportable_tools_for')
+    @mock.patch('allura.ext.admin.admin_main.export_tasks.bulk_export')
+    def test_export_ok(self, bulk_export, exportable_tools, MonQTask):
         MonQTask.query.get.return_value = None
+        exportable_tools.return_value = [
+                mock.Mock(options=mock.Mock(mount_point='tickets')),
+                mock.Mock(options=mock.Mock(mount_point='discussion')),
+            ]
         r = self.api_post('/rest/p/test/admin/export', tools='tickets, discussion', status=200)
         assert_equals(r.json, {
                 'filename': 'test.zip',


Mime
View raw message