From 9127cbffa905b94f17d39a17f3c5617928ca1ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 21 Dec 2015 11:02:19 +0100 Subject: [PATCH] api: remove old ?format=json alternative access point (#9411) --- tests/test_api.py | 7 +++++-- wcs/forms/common.py | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 11681e3..57bfcfb 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -537,8 +537,6 @@ def test_formdata(pub, local_user): sign_uri('/api/forms/test/%s/' % formdata.id, user=local_user), status=200) - resp2 = get_app(pub).get(sign_uri('/test/%s/' % formdata.id, user=local_user)) - assert resp.json == resp2.json assert 'last_update_time' in resp.json assert len(resp.json['fields']) == 6 assert 'foobar' in resp.json['fields'] @@ -559,6 +557,11 @@ def test_formdata(pub, local_user): assert [x.get('id') for x in resp.json['roles']['concerned']] == [str(role.id), str(another_role.id)] assert [x.get('id') for x in resp.json['roles']['actions']] == [str(role.id)] + # check the ?format=json endpoint returns 403 + resp = get_app(pub).get('/test/%s/?format=json' % formdata.id, status=403) + resp2 = get_app(pub).get(sign_uri('/test/%s/' % formdata.id, + user=local_user), status=403) + def test_user_by_nameid(pub, local_user): resp = get_app(pub).get(sign_uri('/api/users/xyz/', user=local_user), status=404) diff --git a/wcs/forms/common.py b/wcs/forms/common.py index 31d776a..9782496 100644 --- a/wcs/forms/common.py +++ b/wcs/forms/common.py @@ -184,8 +184,6 @@ class FormStatusPage(Directory): return r.getvalue() def _q_index(self): - if get_request().is_json(): - return self.export_to_json() mine = self.check_auth() get_logger().info('form %s - id: %s - view' % (self.formdef.name, self.filled.id)) -- 2.6.4