Projet

Général

Profil

0002-misc-add-long_description-for-POST-endpoints-35818.patch

Benjamin Dauvergne, 05 novembre 2019 19:22

Télécharger (2,76 ko)

Voir les différences:

Subject: [PATCH 02/11] misc: add long_description for POST endpoints (#35818)

 passerelle/templates/passerelle/manage/service_view.html | 5 +++++
 passerelle/utils/api.py                                  | 4 ++++
 passerelle/views.py                                      | 2 +-
 tests/test_teamnet_axel.py                               | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)
passerelle/templates/passerelle/manage/service_view.html
76 76
         {% endfor %}
77 77
       </ul>
78 78
       {% endif %}
79
       {% if endpoint.long_description %}
80
         <div class="long-description">
81
           {{ endpoint.long_description }}
82
         </div>
83
       {% endif %}
79 84
    </li>
80 85
    {% endfor %}
81 86
    </ul>
passerelle/utils/api.py
120 120
    def description(self):
121 121
        return self.descriptions.get(self.http_method)
122 122

  
123
    @property
124
    def long_description(self):
125
        return self.http_method == 'post' and self.post and self.post.get('long_description')
126

  
123 127
    def get_params(self):
124 128
        params = []
125 129
        defaults = dict(zip(
passerelle/views.py
337 337
                        raise InvalidParameterValue(parameter)
338 338

  
339 339
        if request.method == 'POST' and self.endpoint.endpoint_info.post:
340
            request_body = self.endpoint.endpoint_info.post.get('request_body')
340
            request_body = self.endpoint.endpoint_info.post.get('request_body', {})
341 341
            if 'application/json' in request_body.get('schema', {}):
342 342
                json_schema = request_body['schema']['application/json']
343 343
                try:
tests/test_teamnet_axel.py
303 303
        assert data[0]['IDFACTURE'] == '456'
304 304
        assert data[0]['total_amount'] == '101'
305 305
        assert data[0]['has_pdf'] is True
306
        assert data[0]['created'] == '2019-02-02'
306 307

  
307 308

  
308 309
def test_endpoint_invoices_history(app, setup):
309
-