0001-mdel-add-user-comment-in-custom-Logitud-s-LocalAcces.patch
passerelle/apps/mdel/mdel.py | ||
---|---|---|
218 | 218 |
attached_files=[], |
219 | 219 |
step=None, |
220 | 220 |
doc=None, |
221 |
user_comment=None, |
|
221 | 222 |
): |
222 | 223 | |
223 | 224 |
super(Description, self).__init__( |
... | ... | |
243 | 244 |
for f in self.piecejointe_xml(attached_files): |
244 | 245 |
root.append(f) |
245 | 246 | |
247 |
# add Logitud Siecle specific tag |
|
248 |
if user_comment: |
|
249 |
local_access = ElementFactory('LocalAccess') |
|
250 |
local_access.append(ElementFactory('CommentaireUsager', text=user_comment)) |
|
251 |
root.append(local_access) |
|
252 | ||
246 | 253 |
self.xml = root |
247 | 254 | |
248 | 255 |
@property |
passerelle/apps/mdel/models.py | ||
---|---|---|
383 | 383 |
attached_files=attached_files, |
384 | 384 |
step=self.step, |
385 | 385 |
doc=doc, |
386 |
user_comment=formdata.get('logitud_commentaire_usager'), |
|
386 | 387 |
) |
387 | 388 |
description.save(inputs_dir) |
388 | 389 |
input_files['enveloppe'] = description.filename |
tests/test_mdel.py | ||
---|---|---|
307 | 307 |
assert root.find('DemandeActe/Titulaire/Filiation/Pere/Prenoms').text == 'Ryu' |
308 | 308 | |
309 | 309 | |
310 |
def test_create_aec_demand_type_with_user_comment(app, setup, aec_payload): |
|
311 |
AEC_PAYLOAD = dict(aec_payload) |
|
312 |
display_id = AEC_PAYLOAD['display_id'] |
|
313 |
AEC_PAYLOAD['fields']['logitud_commentaire_usager'] = 'gentle user comment' |
|
314 |
resp = app.post_json('/mdel/test/create', params=aec_payload, status=200) |
|
315 | ||
316 |
# checking that attached files are referenced in -ent-.xml file |
|
317 |
basedir = os.path.join(get_resource_base_dir(), 'test', 'inputs', '%s-EtatCivil-0' % display_id) |
|
318 |
desc = os.path.join(basedir, '%s-EtatCivil-ent-0.xml' % display_id) |
|
319 | ||
320 |
root = etree.parse(desc).getroot() |
|
321 |
ns = {'ns2': 'http://finances.gouv.fr/dgme/gf/composants/teledemarchexml/donnee/metier'} |
|
322 |
assert root.find('ns2:LocalAccess/ns2:CommentaireUsager', namespaces=ns).text == 'gentle user comment' |
|
323 | ||
324 | ||
310 | 325 |
def test_create_aec_demand_with_output_sftp(app, setup, aec_payload, sftpserver): |
311 | 326 |
setup.outcoming_sftp = SFTP( |
312 | 327 |
'sftp://foo:bar@{server.host}:{server.port}/output/'.format(server=sftpserver) |
313 |
- |