tests: fix grenoble_gru tests inconsistencies (#30458)

This commit is contained in:
Benjamin Dauvergne 2019-02-08 07:15:02 +01:00
parent 07b7b3ec61
commit 10f15acaae
1 changed files with 10 additions and 1 deletions

View File

@ -170,9 +170,17 @@ def test_contact_mode_typologies_list(app, setup):
assert request_post.call_count == 1
def get_typo_response():
types_filename = os.path.join(os.path.dirname(__file__), 'data', 'grenoble_gru_typologies.xml')
types = open(types_filename).read()
typo_response = mock.Mock()
typo_response.content = types
return typo_response
def test_demand_creation_return_codes(app, setup, remote_response):
with mock.patch('passerelle.utils.Request.post') as request_post:
request_post.return_value = remote_response
request_post.side_effect = [get_typo_response(), remote_response]
response = app.post_json(
reverse('generic-endpoint',
kwargs={
@ -217,6 +225,7 @@ def test_demand_creation_with_invalid_params(app, setup):
def test_demand_creation_params(app, setup):
with mock.patch('passerelle.utils.Request.post') as request_post:
request_post.return_value = get_typo_response()
payload = BASIC_PAYLOAD.copy()
payload['intervention_free_address'] = u'169, rue du Château'
payload['applicant_free_address'] = u'1, rue de l\'Est'