Projet

Général

Profil

0001-api-remove-old-format-json-alternative-access-point-.patch

Frédéric Péters, 21 décembre 2015 11:02

Télécharger (1,97 ko)

Voir les différences:

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(-)
tests/test_api.py
537 537
            sign_uri('/api/forms/test/%s/' % formdata.id, user=local_user),
538 538
            status=200)
539 539

  
540
    resp2 = get_app(pub).get(sign_uri('/test/%s/' % formdata.id, user=local_user))
541
    assert resp.json == resp2.json
542 540
    assert 'last_update_time' in resp.json
543 541
    assert len(resp.json['fields']) == 6
544 542
    assert 'foobar' in resp.json['fields']
......
559 557
    assert [x.get('id') for x in resp.json['roles']['concerned']] == [str(role.id), str(another_role.id)]
560 558
    assert [x.get('id') for x in resp.json['roles']['actions']] == [str(role.id)]
561 559

  
560
    # check the ?format=json endpoint returns 403
561
    resp = get_app(pub).get('/test/%s/?format=json' % formdata.id, status=403)
562
    resp2 = get_app(pub).get(sign_uri('/test/%s/' % formdata.id,
563
        user=local_user), status=403)
564

  
562 565
def test_user_by_nameid(pub, local_user):
563 566
    resp = get_app(pub).get(sign_uri('/api/users/xyz/', user=local_user),
564 567
            status=404)
wcs/forms/common.py
184 184
        return r.getvalue()
185 185

  
186 186
    def _q_index(self):
187
        if get_request().is_json():
188
            return self.export_to_json()
189 187
        mine = self.check_auth()
190 188
        get_logger().info('form %s - id: %s - view' % (self.formdef.name, self.filled.id))
191 189

  
192
-