allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [04/21] git commit: [#3154] ticket:392 refactored ForgeLink REST API
Date Tue, 23 Jul 2013 16:59:25 GMT
[#3154]  ticket:392 refactored ForgeLink REST API


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

Branch: refs/heads/tv/6463
Commit: 123a49c51b60348ff2f4bc5a6155ad599ef4b043
Parents: bf67ad1
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Fri Jul 12 14:03:09 2013 +0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Jul 19 21:02:53 2013 +0000

----------------------------------------------------------------------
 ForgeLink/forgelink/link_main.py                  |  4 +++-
 ForgeLink/forgelink/tests/functional/test_rest.py | 17 +++++------------
 2 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/123a49c5/ForgeLink/forgelink/link_main.py
----------------------------------------------------------------------
diff --git a/ForgeLink/forgelink/link_main.py b/ForgeLink/forgelink/link_main.py
index d004fe1..a4794a2 100644
--- a/ForgeLink/forgelink/link_main.py
+++ b/ForgeLink/forgelink/link_main.py
@@ -110,6 +110,7 @@ class RootController(BaseController):
             permanent_redirect(url + h.really_unicode(path).encode('utf-8'))
         return dict()
 
+
 class LinkAdminController(DefaultAdminController):
 
     @expose()
@@ -117,6 +118,7 @@ class LinkAdminController(DefaultAdminController):
         flash('External link URL updated.')
         redirect(c.project.url()+'admin/tools')
 
+
 class RootRestController(BaseController):
 
     def _check_security(self):
@@ -125,6 +127,6 @@ class RootRestController(BaseController):
     @expose('json:')
     def index(self, url='', **kw):
         if request.method == 'POST':
-            require_access(c.app, 'edit')
+            require_access(c.app, 'configure')
             c.app.config.options.url = url
         return dict(url=c.app.config.options.get('url'))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/123a49c5/ForgeLink/forgelink/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeLink/forgelink/tests/functional/test_rest.py b/ForgeLink/forgelink/tests/functional/test_rest.py
index fa02ef1..338094f 100644
--- a/ForgeLink/forgelink/tests/functional/test_rest.py
+++ b/ForgeLink/forgelink/tests/functional/test_rest.py
@@ -25,22 +25,15 @@ from alluratest.controller import TestRestApiBase
 class TestLinkApi(TestRestApiBase):
 
     @td.with_link
-    def test_get_link(self):
-        data = {'url':'http://google.com'}
+    def test_rest_link(self):
         r = self.api_get(u'/rest/p/test/link'.encode('utf-8'))
         assert_equal(r.json['url'], None)
-        r = self.api_post(u'/rest/p/test/link'.encode('utf-8'), **data)
-        assert_equal(r.json['url'], 'http://google.com')
-        r = self.api_get(u'/rest/p/test/link'.encode('utf-8'))
-        assert_equal(r.json['url'], 'http://google.com')
 
-    @td.with_link
-    def test_update_link(self):
-        data = {'url':'http://google.com'}
+        data = {'url': 'http://google.com'}
         r = self.api_post(u'/rest/p/test/link'.encode('utf-8'), **data)
         assert_equal(r.json['url'], 'http://google.com')
-        data = {'url':'http://yahoo.com'}
-        r = self.api_post(u'/rest/p/test/link'.encode('utf-8'), **data)
-        assert_equal(r.json['url'], 'http://yahoo.com')
+
+        data = {'url': 'http://yahoo.com'}
+        self.api_post(u'/rest/p/test/link'.encode('utf-8'), **data)
         r = self.api_get(u'/rest/p/test/link'.encode('utf-8'))
         assert_equal(r.json['url'], 'http://yahoo.com')


Mime
View raw message