You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/08/21 22:12:53 UTC

[37/50] git commit: [#3154] ticket:411 test fixes for zip_and_cleanup

[#3154] ticket:411 test fixes for zip_and_cleanup


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

Branch: refs/heads/db/3154b
Commit: cbcf1b2506f800588c2517e93dbea3bd1b221b8b
Parents: 06f6b77
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Tue Aug 13 17:25:27 2013 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 21 18:12:27 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tasks/export_tasks.py               | 9 ++++++---
 ForgeDiscussion/forgediscussion/tests/test_app.py | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cbcf1b25/Allura/allura/tasks/export_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/export_tasks.py b/Allura/allura/tasks/export_tasks.py
index 3e2a9af..b5fcb34 100644
--- a/Allura/allura/tasks/export_tasks.py
+++ b/Allura/allura/tasks/export_tasks.py
@@ -72,9 +72,12 @@ def bulk_export(project_shortname, tools, username, neighborhood):
     except:
         log.error('Something went wrong during export of project metadata', exc_info=True)
 
-    # If that fails, we need to let it fail
-    # there won't be a valid zip file for the user to get.
-    zip_and_cleanup(project)
+    if tools and len(not_exported_tools) < len(tools):
+        # If that fails, we need to let it fail
+        # there won't be a valid zip file for the user to get.
+        zip_and_cleanup(project)
+    else:
+        log.error('Nothing to export')
 
     user = M.User.by_username(username)
     if not user:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cbcf1b25/ForgeDiscussion/forgediscussion/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/test_app.py b/ForgeDiscussion/forgediscussion/tests/test_app.py
index bc9dcb1..07b65f4 100644
--- a/ForgeDiscussion/forgediscussion/tests/test_app.py
+++ b/ForgeDiscussion/forgediscussion/tests/test_app.py
@@ -41,6 +41,8 @@ class TestBulkExport(TestDiscussionApiBase):
         assert_equal(forums[0]['shortname'], u'general')
         assert_equal(forums[0]['description'], u'Forum about anything you want to talk about.')
         assert_equal(forums[0]['name'], u'General Discussion')
+        forums[0]['threads'] = sorted(forums[0]['threads'],
+            key=lambda x: x['posts'][0]['subject'])
         assert_equal(forums[0]['threads'][0]['posts'][0]['text'], u'Hi boys and girls')
         assert_equal(forums[0]['threads'][0]['posts'][0]['subject'], u'Hi guys')
         assert_equal(forums[0]['threads'][1]['posts'][0]['text'], u'1st post')