incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#6692] Split bulk export REST API test cases up better
Date Fri, 04 Oct 2013 21:28:18 GMT
Updated Branches:
  refs/heads/cj/6692 771c534cf -> 26c031390


[#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/26c03139
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/26c03139
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/26c03139

Branch: refs/heads/cj/6692
Commit: 26c031390e55aeccfd6a90b2eac9aadb3a97f4e0
Parents: 771c534
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Oct 4 21:22:07 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Oct 4 21:22:15 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/26c03139/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