incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [14/50] git commit: [#3153] ticket:389 added config to tracker bulk_export
Date Wed, 21 Aug 2013 15:26:56 GMT
[#3153] ticket:389 added config to tracker bulk_export


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

Branch: refs/heads/db/3154b
Commit: f2930dc4d6c22eb5c58a50e5be55ebacccb256b6
Parents: bdd607c
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Tue Jul 23 18:30:31 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Aug 21 15:25:55 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py              | 14 ++++++++++++++
 ForgeTracker/forgetracker/tests/test_app.py | 11 +++++++++--
 ForgeTracker/forgetracker/tracker_main.py   |  4 +++-
 3 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f2930dc4/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index fb14fc7..b6d6a1f 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -902,3 +902,17 @@ class AppConfig(MappedClass):
     def breadcrumbs(self):
         return self.project.breadcrumbs() + [
             (self.options.mount_point, self.url()) ]
+
+    def __json__(self):
+        return dict(
+            _id=self._id,
+            project_id=self.project_id,
+            discussion_id=self.discussion_id,
+            tool_name=self.tool_name,
+            version=self.version,
+            options=self.options,
+            # project=self.project,
+            # discussion=self.discussion
+            tool_data=self.tool_data,
+            acl=self.acl,
+        )

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f2930dc4/ForgeTracker/forgetracker/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/test_app.py b/ForgeTracker/forgetracker/tests/test_app.py
index e99948b..7437e4d 100644
--- a/ForgeTracker/forgetracker/tests/test_app.py
+++ b/ForgeTracker/forgetracker/tests/test_app.py
@@ -20,7 +20,7 @@ import tempfile
 import json
 import operator
 
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_true
 
 from allura import model as M
 from allura.tests import decorators as td
@@ -44,6 +44,7 @@ class TestBulkExport(TrackerTestController):
         self.tracker.bulk_export(f)
         f.seek(0)
         tracker = json.loads(f.read())
+
         tickets = sorted(tracker['tickets'], key=operator.itemgetter('summary'))
         assert_equal(len(tickets), 2)
         ticket_foo = tickets[1]
@@ -51,4 +52,10 @@ class TestBulkExport(TrackerTestController):
         assert_equal(ticket_foo['custom_fields']['_milestone'], '1.0')
         posts_foo = ticket_foo['discussion_thread']['posts']
         assert_equal(len(posts_foo), 1)
-        assert_equal(posts_foo[0]['text'], 'silly comment')                
+        assert_equal(posts_foo[0]['text'], 'silly comment')         
+
+        tracker_config = tracker['tracker_config']
+        assert_equal(tracker_config['project_id'], unicode(self.project._id))
+        assert_true('options' in tracker_config.keys())
+        assert_true('acl' in tracker_config.keys())
+        assert_equal(tracker_config['options']['mount_point'], 'bugs')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f2930dc4/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 11c495d..8b34b35 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -418,7 +418,9 @@ class ForgeTrackerApp(Application):
             json.dump(ticket, f, cls=jsonify.GenericJSON)
             if i < (count - 1):
                 f.write(',')
-        f.write(']}')
+        f.write('], "tracker_config":')
+        json.dump(self.config, f, cls=jsonify.GenericJSON)
+        f.write('}')
 
     @property
     def bins(self):


Mime
View raw message