Projet

Général

Profil

0008-tests-fix-grenoble_gru-tests-inconsistencies-30458.patch

Benjamin Dauvergne, 08 février 2019 08:43

Télécharger (1,67 ko)

Voir les différences:

Subject: [PATCH 08/13] tests: fix grenoble_gru tests inconsistencies (#30458)

 tests/test_grenoble_gru.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/test_grenoble_gru.py
170 170
        assert request_post.call_count == 1
171 171

  
172 172

  
173
def get_typo_response():
174
    types_filename = os.path.join(os.path.dirname(__file__), 'data', 'grenoble_gru_typologies.xml')
175
    types = open(types_filename).read()
176
    typo_response = mock.Mock()
177
    typo_response.content = types
178
    return typo_response
179

  
180

  
173 181
def test_demand_creation_return_codes(app, setup, remote_response):
174 182
    with mock.patch('passerelle.utils.Request.post') as request_post:
175
        request_post.return_value = remote_response
183
        request_post.side_effect = [get_typo_response(), remote_response]
176 184
        response = app.post_json(
177 185
            reverse('generic-endpoint',
178 186
                    kwargs={
......
217 225

  
218 226
def test_demand_creation_params(app, setup):
219 227
    with mock.patch('passerelle.utils.Request.post') as request_post:
228
        request_post.return_value = get_typo_response()
220 229
        payload = BASIC_PAYLOAD.copy()
221 230
        payload['intervention_free_address'] = u'169, rue du Château'
222 231
        payload['applicant_free_address'] = u'1, rue de l\'Est'
223
-