Projet

Général

Profil

0001-opendatasoft-correct-tests-50212.patch

Nicolas Roche, 25 juin 2021 17:38

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
186 186
@mock.patch('passerelle.utils.Request.get')
187 187
def test_search_using_q(mocked_get, app, connector):
188 188
    endpoint = utils.generic_endpoint_url('opendatasoft', 'search', slug=connector.slug)
189 189
    assert endpoint == '/opendatasoft/my_connector/search'
190 190
    params = {
191 191
        'dataset': 'referentiel-adresse-test',
192 192
        'text_template': '{{numero}} {{nom_rue}} {{nom_commun}}',
193 193
        'q': "rue de l'aubepine",
194
        'rows': 3,
194
        'limit': 3,
195 195
    }
196 196
    mocked_get.return_value = utils.FakedResponse(content=FAKED_CONTENT_Q_SEARCH, status_code=200)
197 197
    resp = app.get(endpoint, params=params, status=200)
198 198
    assert not resp.json['err']
199 199
    assert len(resp.json['data']) == 3
200 200
    # check order is kept
201 201
    assert [x['id'] for x in resp.json['data']] == [
202 202
        'e00cf6161e52a4c8fe510b2b74d4952036cb3473',
......
228 228
    assert resp.json['data'][0]['text'] == "19 RUE DE L'AUBEPINE Lipsheim"
229 229

  
230 230

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