Projet

Général

Profil

0001-opendatasoft-correct-tests-50212.patch

Nicolas Roche, 12 avril 2021 18:16

Télécharger (2,11 ko)

Voir les différences:

Subject: [PATCH 1/3] opendatasoft: correct tests (#50212)

 tests/test_opendatasoft.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/test_opendatasoft.py
188 188
@mock.patch('passerelle.utils.Request.get')
189 189
def test_search_using_q(mocked_get, app, connector):
190 190
    endpoint = utils.generic_endpoint_url('opendatasoft', 'search', slug=connector.slug)
191 191
    assert endpoint == '/opendatasoft/my_connector/search'
192 192
    params = {
193 193
        'dataset': 'referentiel-adresse-test',
194 194
        'text_template': '{{numero}} {{nom_rue}} {{nom_commun}}',
195 195
        'q': "rue de l'aubepine",
196
        'rows': 3,
196
        'limit': 3,
197 197
    }
198 198
    mocked_get.return_value = utils.FakedResponse(content=FAKED_CONTENT_Q_SEARCH, status_code=200)
199 199
    resp = app.get(endpoint, params=params, status=200)
200 200
    assert not resp.json['err']
201 201
    assert len(resp.json['data']) == 3
202 202
    # check order is kept
203 203
    assert [x['id'] for x in resp.json['data']] == [
204 204
        'e00cf6161e52a4c8fe510b2b74d4952036cb3473',
......
230 230
    assert resp.json['data'][0]['text'] == "19 RUE DE L'AUBEPINE Lipsheim"
231 231

  
232 232

  
233 233
@mock.patch('passerelle.utils.Request.get')
234 234
def test_query_q_using_q(mocked_get, app, query):
235 235
    endpoint = '/opendatasoft/my_connector/q/my_query/'
236 236
    params = {
237 237
        'q': "rue de l'aubepine",
238
        'rows': 3,
238
        'limit': 3,
239 239
    }
240 240
    mocked_get.return_value = utils.FakedResponse(content=FAKED_CONTENT_Q_SEARCH, status_code=200)
241 241
    resp = app.get(endpoint, params=params, status=200)
242 242
    assert not resp.json['err']
243 243
    assert len(resp.json['data']) == 3
244 244
    # check order is kept
245 245
    assert [x['id'] for x in resp.json['data']] == [
246 246
        'e00cf6161e52a4c8fe510b2b74d4952036cb3473',
247
-