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 17:26:55 UTC
[13/50] git commit: [#3154] ticket:394 Bulk export: ForgeLink
[#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/6a12be79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6a12be79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6a12be79
Branch: refs/heads/db/3154b
Commit: 6a12be79874bec6c41f3ea904a08070f2946ac3c
Parents: e4f7cf5
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Jul 22 16:47:33 2013 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 21 15:25:55 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/6a12be79/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/6a12be79/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