0001-actesweb-fix-unicode-content-writing-into-file-28272.patch
passerelle/apps/actesweb/models.py | ||
---|---|---|
71 | 71 |
filename = '%s.DEM' % now().strftime('%Y-%m-%d_%H-%M-%S_%f') |
72 | 72 |
filepath = os.path.join(self.basepath, filename) |
73 | 73 |
with tempfile.NamedTemporaryFile(dir=tmp_dir, suffix='.DEM', delete=False) as tpf: |
74 |
tpf.write(demand_content) |
|
74 |
tpf.write(demand_content.encode('utf-8'))
|
|
75 | 75 |
tpf.flush() |
76 | 76 |
os.fsync(tpf.file.fileno()) |
77 | 77 |
os.rename(tpf.name, filepath) |
tests/data/actesweb/payload_mariage.json | ||
---|---|---|
5 | 5 |
"applicant_address_county": "Meurthe-et-Moselle", |
6 | 6 |
"applicant_email": "chelsea@whatever.com", |
7 | 7 |
"applicant_phone": "+33 6 55 44 22 11", |
8 |
"applicant_address_street": "37 Rue du Cheval Blanc",
|
|
8 |
"applicant_address_street": "169, rue du Château",
|
|
9 | 9 |
"applicant_address_zipcode": "54000", |
10 |
"applicant_firstnames": "Kim Chelsea",
|
|
10 |
"applicant_firstnames": "Zoé",
|
|
11 | 11 |
"applicant_lastname": "Bar", |
12 | 12 |
"applicant_name_usage": "nom d'epouse", |
13 | 13 |
"applicant_status": "concerne", |
tests/test_actesweb.py | ||
---|---|---|
76 | 76 |
def assert_file_content_values(filename, expectations): |
77 | 77 |
with io.open(filename, 'rb') as fp: |
78 | 78 |
for line in fp.readlines(): |
79 |
field, value = line.split('=') |
|
79 |
field, value = line.decode('utf-8').split('=')
|
|
80 | 80 |
if field in expectations: |
81 | 81 |
assert value.strip() == expectations[field] |
82 | 82 | |
... | ... | |
120 | 120 |
DEMANDEUR_CIVILITE="Madame", |
121 | 121 |
DEMANDEUR_NOM_USAGE="Whatever", |
122 | 122 |
DEMANDEUR_NOM="Bar", |
123 |
DEMANDEUR_PRENOMS="Kim Chelsea",
|
|
124 |
DEMANDEUR_ADRESSE1="37 Rue du Cheval Blanc",
|
|
123 |
DEMANDEUR_PRENOMS="Zoé",
|
|
124 |
DEMANDEUR_ADRESSE1="169, rue du Château",
|
|
125 | 125 |
DEMANDEUR_VILLE="Nancy", |
126 | 126 |
DEMANDEUR_PAYS="France", |
127 | 127 |
DEMANDEUR_TEL="+33 6 55 44 22 11", |
128 |
- |