incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [01/50] git commit: [#3154] ticket:394 Bulk export: ForgeLink
Date Fri, 23 Aug 2013 16:58:01 GMT
Updated Branches:
  refs/heads/cj/6530 c75da0b48 -> c6ffac86b (forced update)


[#3154]  ticket:394 Bulk export: ForgeLink


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

Branch: refs/heads/cj/6530
Commit: aeaaa111074ea83dc6ec2af441f416288d41c298
Parents: cde71c3
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Mon Jul 22 16:47:33 2013 +0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Aug 22 20:04:40 2013 +0000

----------------------------------------------------------------------
 ForgeLink/forgelink/link_main.py      |  5 ++++
 ForgeLink/forgelink/tests/test_app.py | 39 ++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aeaaa111/ForgeLink/forgelink/link_main.py
----------------------------------------------------------------------
diff --git a/ForgeLink/forgelink/link_main.py b/ForgeLink/forgelink/link_main.py
index be8c918..2350e84 100644
--- a/ForgeLink/forgelink/link_main.py
+++ b/ForgeLink/forgelink/link_main.py
@@ -49,6 +49,7 @@ class ForgeLinkApp(Application):
         ConfigOption('url', str, None)
     ]
     searchable=True
+    exportable=True
     tool_label='External Link'
     default_mount_label='Link name'
     default_mount_point='link'
@@ -93,6 +94,10 @@ class ForgeLinkApp(Application):
         "Remove all the tool's artifacts from the database"
         super(ForgeLinkApp, self).uninstall(project)
 
+    def bulk_export(self, f):
+        f.write('{"url": "%s"}' % self.config.options.get('url', 'test'))
+
+
 class RootController(BaseController):
 
     def _check_security(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aeaaa111/ForgeLink/forgelink/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeLink/forgelink/tests/test_app.py b/ForgeLink/forgelink/tests/test_app.py
new file mode 100644
index 0000000..2176b10
--- /dev/null
+++ b/ForgeLink/forgelink/tests/test_app.py
@@ -0,0 +1,39 @@
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+import tempfile
+import json
+
+from allura.tests import decorators as td
+from allura import model as M
+from alluratest.controller import setup_basic_test
+
+
+class TestBulkExport(object):
+
+    def setUp(self):
+        setup_basic_test()
+
+    @td.with_link
+    def test_bulk_export(self):
+        self.project = M.Project.query.get(shortname='test')
+        self.link = self.project.app_instance('link')
+        self.link.config.options['url'] = 'http://sf.net'
+        f = tempfile.TemporaryFile()
+        self.link.bulk_export(f)
+        f.seek(0)
+        assert json.loads(f.read())['url']=='http://sf.net'
\ No newline at end of file


Mime
View raw message