Projet

Général

Profil

0007-misc-fix-redundant-u-string-prefix-pylint-error-6209.patch

Lauréline Guérin, 22 mars 2022 10:29

Télécharger (111 ko)

Voir les différences:

Subject: [PATCH 07/65] misc: fix redundant-u-string-prefix pylint error
 (#62099)

 passerelle/apps/actesweb/models.py           |   2 +-
 passerelle/apps/airquality/models.py         |   2 +-
 passerelle/apps/api_entreprise/models.py     |   6 +-
 passerelle/apps/api_particulier/models.py    |   6 +-
 passerelle/apps/arpege_ecp/models.py         |  16 +--
 passerelle/apps/astre_rest/models.py         |   2 +-
 passerelle/apps/astregs/models.py            |   2 +-
 passerelle/apps/atos_genesys/models.py       |   8 +-
 passerelle/apps/cartads_cs/models.py         |   4 +-
 passerelle/apps/choosit/models.py            |  16 +--
 passerelle/apps/cityweb/models.py            |   2 +-
 passerelle/apps/csvdatasource/models.py      |  10 +-
 passerelle/apps/family/models.py             |   2 +-
 passerelle/apps/gesbac/models.py             |   2 +-
 passerelle/apps/maelis/models.py             |   2 +-
 passerelle/apps/mdel/models.py               |   2 +-
 passerelle/apps/opengis/models.py            |   6 +-
 passerelle/apps/sp_fr/models.py              |  30 ++---
 passerelle/apps/vivaticket/models.py         |   2 +-
 passerelle/base/models.py                    |  10 +-
 passerelle/base/views.py                     |   4 +-
 passerelle/contrib/dpark/models.py           |   4 +-
 passerelle/contrib/esirius_swi/models.py     |   2 +-
 passerelle/contrib/greco/models.py           |   2 +-
 passerelle/contrib/mdph13/models.py          |  12 +-
 passerelle/contrib/solis_apa/conciliation.py |   4 +-
 passerelle/contrib/solis_apa/models.py       |  56 +++++-----
 passerelle/contrib/solis_apa/suivi.py        |   4 +-
 passerelle/contrib/teamnet_axel/models.py    |   4 +-
 passerelle/contrib/toulouse_axel/models.py   |   2 +-
 passerelle/sms/models.py                     |   4 +-
 passerelle/utils/conversion.py               |   2 +-
 passerelle/utils/xml.py                      |   2 +-
 tests/conftest.py                            |   2 +-
 tests/test_api_entreprise.py                 |   2 +-
 tests/test_api_particulier.py                |   2 +-
 tests/test_arpege_ecp.py                     |   2 +-
 tests/test_atal.py                           |   2 +-
 tests/test_atos_genesys.py                   |  50 ++++-----
 tests/test_availability.py                   |   2 +-
 tests/test_base_adresse.py                   |  38 +++----
 tests/test_cartads_cs.py                     |  96 ++++++++--------
 tests/test_csv_datasource.py                 |   4 +-
 tests/test_dpark.py                          |  42 +++----
 tests/test_feeds.py                          |   2 +-
 tests/test_gdema.py                          |  14 +--
 tests/test_generic_endpoint.py               |   6 +-
 tests/test_grenoble_gru.py                   |  10 +-
 tests/test_iws.py                            |   4 +-
 tests/test_lille_kimoce.py                   |   2 +-
 tests/test_okina.py                          |  18 +--
 tests/test_opendatasoft.py                   |   8 +-
 tests/test_opengis.py                        |   2 +-
 tests/test_photon.py                         |   2 +-
 tests/test_planitech.py                      | 110 +++++++++----------
 tests/test_proxylogger.py                    |  28 ++---
 tests/test_requests.py                       |   8 +-
 tests/test_signature.py                      |   4 +-
 tests/test_soap.py                           |   2 +-
 tests/test_solis.py                          |  10 +-
 tests/test_strasbourg_eu.py                  |  22 ++--
 tests/test_teamnet_axel.py                   |   2 +-
 tests/test_toulouse_axel.py                  |   2 +-
 tests/wcs/conftest.py                        |   4 +-
 tests/wcs/test_conftest.py                   |   2 +-
 tests/wcs/test_sp_fr.py                      |   4 +-
 66 files changed, 370 insertions(+), 372 deletions(-)
passerelle/apps/actesweb/models.py
44 44
    category = _('Civil Status Connectors')
45 45

  
46 46
    class Meta:
47
        verbose_name = u"ActesWeb - Demande d'acte d'état civil"
47
        verbose_name = "ActesWeb - Demande d'acte d'état civil"
48 48

  
49 49
    @property
50 50
    def basepath(self):
passerelle/apps/airquality/models.py
29 29
class AirQuality(BaseResource):
30 30
    category = _('Misc')
31 31
    api_description = _(
32
        u'''
32
        '''
33 33
        This API provides a unique format for the air quality data of various places.
34 34
        (But only supports the Rhône-Alpes region for now).
35 35
        '''
passerelle/apps/api_entreprise/models.py
101 101
        try:
102 102
            response = self.requests.get(url, data=params, cache_duration=300)
103 103
        except requests.RequestException as e:
104
            raise APIError(u'API-entreprise connection error: %s' % exception_to_text(e), data=[])
104
            raise APIError('API-entreprise connection error: %s' % exception_to_text(e), data=[])
105 105
        try:
106 106
            data = response.json()
107 107
        except ValueError as e:
108 108
            content = response.text[:1000]
109 109
            raise APIError(
110
                u'API-entreprise returned non-JSON content with status %s: %s'
110
                'API-entreprise returned non-JSON content with status %s: %s'
111 111
                % (response.status_code, content),
112 112
                data={
113 113
                    'status_code': response.status_code,
......
122 122
                    'err_desc': data.get('message', 'not-found'),
123 123
                }
124 124
            raise APIError(
125
                u'API-entreprise returned a non 200 status %s: %s' % (response.status_code, data),
125
                'API-entreprise returned a non 200 status %s: %s' % (response.status_code, data),
126 126
                data={
127 127
                    'status_code': response.status_code,
128 128
                    'content': data,
passerelle/apps/api_particulier/models.py
92 92
            response = self.requests.get(url, headers=headers, timeout=5, **kwargs)
93 93
        except requests.RequestException as e:
94 94
            raise APIError(
95
                u'API-particulier platform "%s" connection error: %s' % (self.platform, exception_to_text(e)),
95
                'API-particulier platform "%s" connection error: %s' % (self.platform, exception_to_text(e)),
96 96
                log_error=True,
97 97
                data={
98 98
                    'code': 'connection-error',
......
105 105
        except JSONDecodeError as e:
106 106
            content = repr(response.content[:1000])
107 107
            raise APIError(
108
                u'API-particulier platform "%s" returned non-JSON content with status %s: %s'
108
                'API-particulier platform "%s" returned non-JSON content with status %s: %s'
109 109
                % (self.platform, response.status_code, content),
110 110
                log_error=True,
111 111
                data={
......
135 135
                    }
136 136
                raise APIError(message, data=error_data)
137 137
            raise APIError(
138
                u'API-particulier platform "%s" returned a non 200 status %s: %s'
138
                'API-particulier platform "%s" returned a non 200 status %s: %s'
139 139
                % (self.platform, response.status_code, data),
140 140
                log_error=True,
141 141
                data={
passerelle/apps/arpege_ecp/models.py
59 59
            )
60 60
            response.raise_for_status()
61 61
        except RequestException as e:
62
            raise APIError(u'Arpege server is down: %s' % e)
62
            raise APIError('Arpege server is down: %s' % e)
63 63
        try:
64 64
            result = response.json()
65 65
        except ValueError:
66
            raise APIError(u'Arpege server is down: no JSON content returned, %r' % response.content[:1000])
66
            raise APIError('Arpege server is down: no JSON content returned, %r' % response.content[:1000])
67 67
        if result.get('Data'):
68 68
            if 'AccessToken' not in result['Data']:
69
                raise APIError(u'Error on LoginParSubOIDC: missing Data/AccessToken')
69
                raise APIError('Error on LoginParSubOIDC: missing Data/AccessToken')
70 70
            if not isinstance(result['Data']['AccessToken'], six.string_types):
71
                raise APIError(u'Error on LoginParSubOIDC: Data/AccessToken is not string')
71
                raise APIError('Error on LoginParSubOIDC: Data/AccessToken is not string')
72 72
            return result['Data']['AccessToken']
73
        raise APIError(u'%s (%s)' % (result.get('LibErreur'), result.get('CodErreur')))
73
        raise APIError('%s (%s)' % (result.get('LibErreur'), result.get('CodErreur')))
74 74

  
75 75
    @endpoint(
76 76
        name='api',
......
87 87
            response = self.requests.get(url, params=params, auth=auth)
88 88
            response.raise_for_status()
89 89
        except RequestException as e:
90
            raise APIError(u'Arpege server is down: %s' % e)
90
            raise APIError('Arpege server is down: %s' % e)
91 91
        data = []
92 92
        try:
93 93
            result = response.json()
94 94
        except ValueError:
95
            raise APIError(u'No JSON content returned: %r' % response.content[:1000])
95
            raise APIError('No JSON content returned: %r' % response.content[:1000])
96 96
        if not result.get('Data'):
97 97
            raise APIError("%s (%s)" % (result.get('LibErreur'), result.get('CodErreur')))
98 98
        for demand in result['Data']['results']:
......
101 101
                receipt_time = parse_time(data_administratives['heure_depot'])
102 102
                receipt_date = parse_date(data_administratives['date_depot'])
103 103
            except (KeyError, TypeError) as e:
104
                raise APIError(u'Arpege error: %s %r' % (e, json.dumps(demand)[:1000]))
104
                raise APIError('Arpege error: %s %r' % (e, json.dumps(demand)[:1000]))
105 105
            d = {
106 106
                'url': demand['url'],
107 107
                'title': data_administratives.get('LibelleQualificationTypeDemande'),
passerelle/apps/astre_rest/models.py
179 179
    category = _('Business Process Connectors')
180 180

  
181 181
    class Meta:
182
        verbose_name = u'Astre REST'
182
        verbose_name = 'Astre REST'
183 183

  
184 184
    def check_status(self):
185 185
        self._astre_call('astre/webservices/gf/documents/referentiel/typedocument/list/json')
passerelle/apps/astregs/models.py
447 447
    log_requests_errors = False
448 448

  
449 449
    class Meta:
450
        verbose_name = u'AstresGS'
450
        verbose_name = 'AstresGS'
451 451

  
452 452
    def check_status(self):
453 453
        response = self.requests.get(self.wsdl_base_url)
passerelle/apps/atos_genesys/models.py
150 150
        parameters={
151 151
            'category': {
152 152
                'description': _('Category of codification'),
153
                'example_value': u'MOT_APA',
153
                'example_value': 'MOT_APA',
154 154
            }
155 155
        },
156 156
    )
......
283 283
        # create CIVILITE
284 284
        for identification in d.get('IDENTIFICATION', []):
285 285
            sexe = identification.get('SEXE', '')
286
            identification['CIVILITE'] = {'M': u'Monsieur', 'F': u'Madame'}.get(sexe, '')
286
            identification['CIVILITE'] = {'M': 'Monsieur', 'F': 'Madame'}.get(sexe, '')
287 287
        return d
288 288

  
289 289
    @endpoint(
......
327 327
            data.append(
328 328
                {
329 329
                    'id': str(link.id),
330
                    'text': u' '.join(text_parts),
330
                    'text': ' '.join(text_parts),
331 331
                    'id_per': link.id_per,
332 332
                    'dossier': dossier,
333 333
                }
......
430 430
                cmu_nais = to_ascii(identification.get('CMU_NAIS', '')).lower()
431 431
                if cmu_nais and commune_naissance != cmu_nais:
432 432
                    self.logger.debug(
433
                        u'id_per %s: CMU_NAIS(%s) does not match commune_naissance(%s)',
433
                        'id_per %s: CMU_NAIS(%s) does not match commune_naissance(%s)',
434 434
                        id_per,
435 435
                        cmu_nais,
436 436
                        commune_naissance,
passerelle/apps/cartads_cs/models.py
247 247
                def format_cerfa_label(x):
248 248
                    try:
249 249
                        if x['Description']:
250
                            return u'%(Nom)s: %(Description)s' % x
250
                            return '%(Nom)s: %(Description)s' % x
251 251
                    except KeyError:
252 252
                        pass
253
                    return u'%(Nom)s' % x
253
                    return '%(Nom)s' % x
254 254

  
255 255
                data_cache, dummy = CartaDSDataCache.objects.get_or_create(
256 256
                    data_type='liste_pdf',
passerelle/apps/choosit/models.py
24 24
                    'err': 1,
25 25
                    'err_desc': 'Choosit error: some destinations failed',
26 26
                    'data': [
27
                        [u'0033688888888', u'Choosit error: bad JSON response'],
28
                        [u'0033677777777', u'Choosit error: bad JSON response'],
27
                        ['0033688888888', 'Choosit error: bad JSON response'],
28
                        ['0033677777777', 'Choosit error: bad JSON response'],
29 29
                    ],
30 30
                },
31 31
            },
......
37 37
                    'err': 1,
38 38
                    'err_desc': 'Choosit error: some destinations failed',
39 39
                    'data': [
40
                        [u'0033688888888', u'Choosit error: not ok'],
41
                        [u'0033677777777', u'Choosit error: not ok'],
40
                        ['0033688888888', 'Choosit error: not ok'],
41
                        ['0033677777777', 'Choosit error: not ok'],
42 42
                    ],
43 43
                },
44 44
            },
45 45
            {
46 46
                'response': {
47
                    'result': u'Envoi terminé',
47
                    'result': 'Envoi terminé',
48 48
                    'sms_id': 1234,
49 49
                },
50 50
                'result': {
51 51
                    'err': 0,
52 52
                    'data': [
53
                        [u'0033688888888', {'result': u'Envoi terminé', 'sms_id': 1234}],
54
                        [u'0033677777777', {'result': u'Envoi terminé', 'sms_id': 1234}],
53
                        ['0033688888888', {'result': 'Envoi terminé', 'sms_id': 1234}],
54
                        ['0033677777777', {'result': 'Envoi terminé', 'sms_id': 1234}],
55 55
                    ],
56 56
                },
57 57
            },
......
92 92
                    if not isinstance(output, dict):
93 93
                        results.append('Choosit error: JSON response is not a dict %r' % output)
94 94
                    elif 'error' in output:
95
                        results.append(u'Choosit error: %s' % output['error'])
95
                        results.append('Choosit error: %s' % output['error'])
96 96
                    else:
97 97
                        results.append(output)
98 98
        if any(isinstance(result, string_types) for result in results):
passerelle/apps/cityweb/models.py
39 39
    category = _('Civil Status Connectors')
40 40

  
41 41
    class Meta:
42
        verbose_name = u"CityWeb - Demande d'acte d'état civil"
42
        verbose_name = "CityWeb - Demande d'acte d'état civil"
43 43

  
44 44
    @classmethod
45 45
    def get_verbose_name(cls):
passerelle/apps/csvdatasource/models.py
315 315
        try:
316 316
            query = Query.objects.get(resource=self.id, slug=query_name)
317 317
        except Query.DoesNotExist:
318
            raise APIError(u'no such query')
318
            raise APIError('no such query')
319 319
        return self.execute_query(request, query, query_params=kwargs)
320 320

  
321 321
    def execute_query(self, request, query, query_params=None):
......
337 337
                        data['name'] = titles[i]
338 338
                    else:
339 339
                        data['idx'] = i
340
                    raise APIError(u'invalid %s expression' % kind, data=data)
340
                    raise APIError('invalid %s expression' % kind, data=data)
341 341
                codes.append((code, expr))
342 342
            for row in data:
343 343
                new_row = []
......
356 356
                            data['name'] = titles[i]
357 357
                        else:
358 358
                            data['idx'] = i
359
                        raise APIError(u'invalid %s expression' % kind, data=data)
359
                        raise APIError('invalid %s expression' % kind, data=data)
360 360
                    new_row.append(result)
361 361
                yield new_row, row
362 362

  
......
383 383
                    hash(new_row)
384 384
                except TypeError:
385 385
                    raise APIError(
386
                        u'distinct value is unhashable',
386
                        'distinct value is unhashable',
387 387
                        data={
388 388
                            'row': repr(row),
389 389
                            'distinct': repr(new_row),
......
402 402
            for mapping in projection:
403 403
                name, expr = mapping.split(':', 1)
404 404
                if not identifier_re.match(name):
405
                    raise APIError(u'invalid projection name', data=name)
405
                    raise APIError('invalid projection name', data=name)
406 406
                titles.append(name)
407 407
                expressions.append(expr)
408 408
            new_data = []
passerelle/apps/family/models.py
470 470

  
471 471
    @property
472 472
    def fullname(self):
473
        return u'%s %s' % (self.first_name, self.last_name)
473
        return '%s %s' % (self.first_name, self.last_name)
474 474

  
475 475
    def __str__(self):
476 476
        return self.fullname
passerelle/apps/gesbac/models.py
224 224
    category = _('Business Process Connectors')
225 225

  
226 226
    class Meta:
227
        verbose_name = u'Gesbac'
227
        verbose_name = 'Gesbac'
228 228

  
229 229
    def check_status(self):
230 230
        with self.outcoming_sftp.client() as out_sftp:
passerelle/apps/maelis/models.py
97 97
    category = _('Business Process Connectors')
98 98

  
99 99
    class Meta:
100
        verbose_name = u'Maélis'
100
        verbose_name = 'Maélis'
101 101

  
102 102
    @classmethod
103 103
    def get_verbose_name(cls):
passerelle/apps/mdel/models.py
350 350

  
351 351
            # Set aec_nature if aec_type_raw == DECES
352 352
            if formdata.get('aec_type_raw') == 'DECES' and not formdata.get('aec_nature_raw'):
353
                formdata['aec_nature'] = u'Copie integrale'
353
                formdata['aec_nature'] = 'Copie integrale'
354 354
                formdata['aec_nature_raw'] = 'COPIE-INTEGRALE'
355 355

  
356 356
            # Set motif_demand if none
passerelle/apps/opengis/models.py
221 221
        except ValueError:
222 222
            self.handle_opengis_error(response)
223 223
            # if handle_opengis_error did not raise an error, we raise a generic one
224
            raise APIError(
225
                u'OpenGIS Error: unparsable error', data={'content': repr(response.content[:1024])}
226
            )
224
            raise APIError('OpenGIS Error: unparsable error', data={'content': repr(response.content[:1024])})
227 225
        for feature in response['features']:
228 226
            feature['text'] = feature['properties'].get(property_name)
229 227
            data.append(feature)
......
245 243
            return None
246 244
        content = exception_text.text
247 245
        content = html.unescape(content)
248
        raise APIError(u'OpenGIS Error: %s' % exception_code or 'unknown code', data={'text': content})
246
        raise APIError('OpenGIS Error: %s' % exception_code or 'unknown code', data={'text': content})
249 247

  
250 248
    def convert_coordinates(self, lon, lat, reverse=False):
251 249
        lon, lat = float(lon), float(lat)
passerelle/apps/sp_fr/models.py
335 335
            with self.resource.output_sftp.client() as client:
336 336
                with client.open(self.request.response_zip_filename, mode='w') as fd:
337 337
                    self.request.build_response_zip(
338
                        fd, etat='100', commentaire=u'Demande transmise à la collectivité'
338
                        fd, etat='100', commentaire='Demande transmise à la collectivité'
339 339
                    )
340 340
            with self.resource.input_sftp.client() as client:
341 341
                with client.open('DONE/' + self.request.response_zip_filename, mode='w') as fd:
342 342
                    self.request.build_response_zip(
343
                        fd, etat='100', commentaire=u'Demande transmise à la collectivité'
343
                        fd, etat='100', commentaire='Demande transmise à la collectivité'
344 344
                    )
345 345

  
346 346
        def get_data(self, data, name):
......
355 355
            numero_permis_construire = get('doc_declarant_designation_permis_numero_permis_construire')
356 356
            numero_permis_amenager = get('doc_declarant_designation_permis_numero_permis_amenager')
357 357
            data['type_permis'] = (
358
                u'Un permis de construire' if numero_permis_construire else u'Un permis d\'aménager'
358
                'Un permis de construire' if numero_permis_construire else 'Un permis d\'aménager'
359 359
            )
360 360
            data['numero_permis'] = numero_permis_construire or numero_permis_amenager
361 361
            particulier = get('doc_declarant_identite_type_personne').strip().lower() == 'true'
362
            data['type_declarant'] = u'Un particulier' if particulier else u'Une personne morale'
362
            data['type_declarant'] = 'Un particulier' if particulier else 'Une personne morale'
363 363
            if particulier:
364 364
                data['nom'] = get('doc_declarant_identite_personne_physique_nom')
365 365
                data['prenoms'] = get('doc_declarant_identite_personne_physique_prenom')
......
382 382
                    get('doc_declarant_identite_personne_morale_representant_personne_morale_civilite'), ''
383 383
                )
384 384
            data['portee'] = (
385
                u'Pour la totalité des travaux'
385
                'Pour la totalité des travaux'
386 386
                if get('doc_ouverture_chantier_totalite_travaux').lower().strip() == 'true'
387
                else u'Pour une tranche des travaux'
387
                else 'Pour une tranche des travaux'
388 388
            )
389 389

  
390 390
        def update_data_recensementCitoyen(self, data):
......
397 397
            data['motif'] = {'RECENSEMENT': '1', 'EXEMPTION': '2'}[motif]
398 398
            if data['motif'] == '2':
399 399
                data['motif_exempte'] = (
400
                    u"Titulaire d'une carte d'invalidité de 80% minimum"
400
                    "Titulaire d'une carte d'invalidité de 80% minimum"
401 401
                    if get('recensementcitoyen_formalite_formalitemotifcode_2') == 'INFIRME'
402
                    else u"Autre situation"
402
                    else "Autre situation"
403 403
                )
404 404
            data['justificatif_exemption'] = get('pj_je')
405 405
            data['double_nationalite'] = 'Oui' if get('recensementcitoyen_personne_nationalite') else 'Non'
......
421 421
            data['justificatif_identite'] = get('pj_ji')
422 422
            situation_matrimoniale = get('recensementcitoyen_personne_situationfamille_situationmatrimoniale')
423 423
            data['situation_familiale'] = {
424
                u'Célibataire': u'Célibataire',
425
                u'Marié': u'Marié(e)',
426
            }.get(situation_matrimoniale, u'Autres')
427
            if data['situation_familiale'] == u'Autres':
424
                'Célibataire': 'Célibataire',
425
                'Marié': 'Marié(e)',
426
            }.get(situation_matrimoniale, 'Autres')
427
            if data['situation_familiale'] == 'Autres':
428 428
                data['situation_familiale_precision'] = situation_matrimoniale
429 429
            pupille = get('recensementcitoyen_personne_situationfamille_pupille')
430 430
            data['pupille'] = 'Oui' if pupille else 'Non'
431 431
            data['pupille_categorie'] = {
432
                'NATION': u"Pupille de la nation",
433
                'ETAT': u"Pupille de l'État",
432
                'NATION': "Pupille de la nation",
433
                'ETAT': "Pupille de l'État",
434 434
            }.get(pupille)
435 435
            for idx in ['', '_1', '_2']:
436 436
                code = get('recensementcitoyen_personne_methodecontact%s_canalcode' % idx)
......
774 774
            './/{%(mdel)s}MotDePasse' % ns
775 775
        ).text
776 776
        response.find('.//{%(pec)s}Etat' % ns).text = '100'
777
        response.find('.//{%(pec)s}Commentaire' % ns).text = u'Dossier transmis à la collectivité'
777
        response.find('.//{%(pec)s}Commentaire' % ns).text = 'Dossier transmis à la collectivité'
778 778
        return response
779 779

  
780 780
    def build_response_zip(self, fd_or_filename, etat, commentaire):
passerelle/apps/vivaticket/models.py
146 146
    log_requests_errors = False
147 147

  
148 148
    class Meta:
149
        verbose_name = u'VivaTicket'
149
        verbose_name = 'VivaTicket'
150 150

  
151 151
    @classmethod
152 152
    def get_verbose_name(cls):
passerelle/base/models.py
85 85
    )
86 86

  
87 87
    def __str__(self):
88
        return u'%s <%s>' % (self.fullname, self.username)
88
        return '%s <%s>' % (self.fullname, self.username)
89 89

  
90 90
    def clean(self):
91 91
        if self.keytype and not self.key:
......
513 513
            if status == 'down' and not self.down():  # new downtime
514 514
                if availability_parameters.has_zero_delay():
515 515
                    self.logger.error(
516
                        u'connector "%s" (%s) is now down: %s', self, self.__class__.__name__, message
516
                        'connector "%s" (%s) is now down: %s', self, self.__class__.__name__, message
517 517
                    )
518 518
                else:
519 519
                    self.logger.warning(
520
                        u'connector "%s" (%s) is now down: %s', self, self.__class__.__name__, message
520
                        'connector "%s" (%s) is now down: %s', self, self.__class__.__name__, message
521 521
                    )
522 522
            ResourceStatus(
523 523
                resource_type=resource_type, resource_pk=self.pk, status=status, message=message
524 524
            ).save()
525 525
            if status == 'up' and current_status:
526
                self.logger.info(u'connector "%s" (%s) is back up', self, self.__class__.__name__)
526
                self.logger.info('connector "%s" (%s) is back up', self, self.__class__.__name__)
527 527
        elif status == 'down':
528 528
            # check last_notification_downtime and current downtime to see if it matches a new notification delay
529 529
            last_notification_timestamp = (
......
550 550
                        else:
551 551
                            human_duration = 'for %d minutes' % downtime
552 552
                        self.logger.error(
553
                            u'connector "%s" (%s) has been down %s: %s',
553
                            'connector "%s" (%s) has been down %s: %s',
554 554
                            self,
555 555
                            self.__class__.__name__,
556 556
                            human_duration,
passerelle/base/views.py
218 218

  
219 219
        # log changes to notification delays
220 220
        if 'notification_delays' in form.changed_data:
221
            resource.logger.info(u'availability checks delays set to %s', form.instance.notification_delays)
221
            resource.logger.info('availability checks delays set to %s', form.instance.notification_delays)
222 222

  
223 223
        # log changes to run_check, if enabled immediately check for availability
224 224
        if 'run_check' in form.changed_data:
225 225
            resource.logger.info(
226
                u'availability checks %s', 'enabled' if form.instance.run_check else 'disabled'
226
                'availability checks %s', 'enabled' if form.instance.run_check else 'disabled'
227 227
            )
228 228
            if form.instance.run_check:
229 229
                resource.availability()
passerelle/contrib/dpark/models.py
259 259
            }
260 260
            if code_retour in errors:
261 261
                return Error(errors[code_retour], msg=msg_retour)
262
            return Error('other-error', msg=u'code="%s" msg="%s"' % (code_retour, msg_retour))
262
            return Error('other-error', msg='code="%s" msg="%s"' % (code_retour, msg_retour))
263 263

  
264 264
    @endpoint(perm='can_access', description=_('Check service availibity'))
265 265
    def ping(self, request, *args, **kwargs):
......
554 554
            try:
555 555
                pdf_content = to_pdf(file_raw_content)
556 556
            except ValueError as e:
557
                errors.append(u'<%s> cannot be converted to PDF: %s' % (key, e))
557
                errors.append('<%s> cannot be converted to PDF: %s' % (key, e))
558 558
                continue
559 559
            filename = value['filename']
560 560
            if not filename.lower().endswith('.pdf'):
passerelle/contrib/esirius_swi/models.py
34 34
    category = _('Business Process Connectors')
35 35

  
36 36
    class Meta:
37
        verbose_name = u'eSirius sitewaitingindicator'
37
        verbose_name = 'eSirius sitewaitingindicator'
38 38

  
39 39
    @classmethod
40 40
    def get_verbose_name(cls):
passerelle/contrib/greco/models.py
35 35
from .formdata import CREATION_SCHEMA, FormData, list_schema_fields
36 36

  
37 37
# taken from https://lsimons.wordpress.com/2011/03/17/stripping-illegal-characters-out-of-xml-in-python/
38
_illegal_xml_chars_RE = re.compile(u'[\x00-\x08\x0b\x0c\x0e-\x1F\uD800-\uDFFF\uFFFE\uFFFF]')
38
_illegal_xml_chars_RE = re.compile('[\x00-\x08\x0b\x0c\x0e-\x1F\uD800-\uDFFF\uFFFE\uFFFF]')
39 39

  
40 40

  
41 41
def escape_xml_illegal_chars(val, replacement='?'):
passerelle/contrib/mdph13/models.py
114 114
            for person in entourage:
115 115
                if not isinstance(person, dict):
116 116
                    raise APIError('entourage-content-must-be-dicts', data=content)
117
                if person.get('role') in [u'Père', u'Mère']:
117
                if person.get('role') in ['Père', 'Mère']:
118 118
                    new_entourage.setdefault('parents', []).append(person)
119 119
                else:
120 120
                    new_entourage.setdefault('aidants', []).append(person)
......
131 131
                raise APIError('demandes-content-must-be-dicts', data=content)
132 132
            new_demandes = {}
133 133
            typologies = {
134
                u'demande en cours': 'en_cours',
135
                u'traitée et expédiée': 'historique',
136
                u'traitée non expédiée': 'historique',
134
                'demande en cours': 'en_cours',
135
                'traitée et expédiée': 'historique',
136
                'traitée non expédiée': 'historique',
137 137
            }
138 138
            if not all(isinstance(demande.get('typologie'), six.text_type) for demande in demandes):
139 139
                raise APIError('typologie-must-be-a-string', data=content)
......
364 364
            parts.append(prenom)
365 365
        if nom:
366 366
            parts.append(nom)
367
        parts.append(u'#%s' % numero)
367
        parts.append('#%s' % numero)
368 368
        return ' '.join(parts)
369 369

  
370 370
    def __str__(self):
371
        return self.display_name or u'#%s' % self.file_number
371
        return self.display_name or '#%s' % self.file_number
372 372

  
373 373
    class Meta:
374 374
        unique_together = (
passerelle/contrib/solis_apa/conciliation.py
208 208
            )
209 209
    criterium = []
210 210
    for xpath, local in config['input'].items():
211
        criterium.append({'key': xpath, 'value': data.get(local, u'')})
211
        criterium.append({'key': xpath, 'value': data.get(local, '')})
212 212
    returndata = []
213 213
    for xpath in config['output']:
214 214
        returndata.append(xpath)
......
235 235
        x = entity
236 236
        for k in xpath.split('/'):
237 237
            x = x.get(k, {})
238
        d[xpath] = x or u''
238
        d[xpath] = x or ''
239 239
    return d
passerelle/contrib/solis_apa/models.py
164 164
        ret = []
165 165

  
166 166
        for v in villes:
167
            # {u'Attributes': {u'Attribute': {u'id': u'stdr.commune.cp_lieu',
168
            # u'value': 14210}}, u'Keys': {u'Key': [{u'id':
169
            # u'stdr.commune.code_a_com', u'value': 771}, {u'id':
170
            # u'stdr.commune.code_dep', u'value': 14}]}, u'id':
171
            # u'commune-14-771', u'value': u'NEUILLY LE MALHERBE'},
167
            # {'Attributes': {'Attribute': {'id': 'stdr.commune.cp_lieu',
168
            # 'value': 14210}}, 'Keys': {'Key': [{'id':
169
            # 'stdr.commune.code_a_com', 'value': 771}, {'id':
170
            # 'stdr.commune.code_dep', 'value': 14}]}, 'id':
171
            # 'commune-14-771', 'value': 'NEUILLY LE MALHERBE'},
172 172
            #
173 173
            # However, the lack of some informations has already been observed,
174 174
            # so there are some test/continue here
......
204 204
        lieux = call.get('results')
205 205
        ret = []
206 206
        for l in lieux:
207
            # '@affinity': u'5',
208
            # 'CodeDepartement/@V': u'',
209
            # 'CodeLieu/@V': u'0110',
210
            # 'CodePostal/@V': u'14000',
211
            # 'Commune/NomCom/@V': u'CAEN',
212
            # 'Commune/PK/CodeCommune/@V': u'118',
213
            # 'NatureLieu/@Lc': u'RUE',
214
            # 'NomLieu/@V': u'DU BEAU SITE'
207
            # '@affinity': '5',
208
            # 'CodeDepartement/@V': '',
209
            # 'CodeLieu/@V': '0110',
210
            # 'CodePostal/@V': '14000',
211
            # 'Commune/NomCom/@V': 'CAEN',
212
            # 'Commune/PK/CodeCommune/@V': '118',
213
            # 'NatureLieu/@Lc': 'RUE',
214
            # 'NomLieu/@V': 'DU BEAU SITE'
215 215
            for k, v in l.items():
216 216
                l[k] = v.strip()
217 217
            ret.append(
......
232 232
        individus = call.get('results')
233 233
        ret = []
234 234
        for i in individus:
235
            # i = {'@affinity': u'3',
236
            #  'Dossier/Adresse/Commune/NomCom/@V': u'ST JULIEN EN GENEVOIS',
237
            #  'Dossier/Adresse/ComplementLieu/@V': u'ROUTE DE THOIRY',
238
            #  'Dossier/Adresse/CpLieu/@V': u'74160',
239
            #  'Dossier/Adresse/NatureLieu/@Lc': u'',
240
            #  'Dossier/Adresse/NomLieu/@V': u'.',
241
            #  'Dossier/Adresse/NumeroLieu/@V': u'39',
242
            #  'Dossier/PK/IndexDossier/@V': u'162438',
243
            #  'EtatCivil/DateNaissance/@V': u'1933-08-28',
244
            #  'EtatCivil/Nom/@V': u'DUPONT',
245
            #  'EtatCivil/NomJeuneFille/@V': u'BUATHIER',
246
            #  'EtatCivil/Prenom/@V': u'JEANNE',
247
            #  'PK/IndexIndividu/@V': u'208359'},
235
            # i = {'@affinity': '3',
236
            #  'Dossier/Adresse/Commune/NomCom/@V': 'ST JULIEN EN GENEVOIS',
237
            #  'Dossier/Adresse/ComplementLieu/@V': 'ROUTE DE THOIRY',
238
            #  'Dossier/Adresse/CpLieu/@V': '74160',
239
            #  'Dossier/Adresse/NatureLieu/@Lc': '',
240
            #  'Dossier/Adresse/NomLieu/@V': '.',
241
            #  'Dossier/Adresse/NumeroLieu/@V': '39',
242
            #  'Dossier/PK/IndexDossier/@V': '162438',
243
            #  'EtatCivil/DateNaissance/@V': '1933-08-28',
244
            #  'EtatCivil/Nom/@V': 'DUPONT',
245
            #  'EtatCivil/NomJeuneFille/@V': 'BUATHIER',
246
            #  'EtatCivil/Prenom/@V': 'JEANNE',
247
            #  'PK/IndexIndividu/@V': '208359'},
248 248
            for k, v in i.items():
249 249
                i[k] = v.strip()
250 250
            njf = i['EtatCivil/NomJeuneFille/@V']
251 251
            if njf:
252
                i['EtatCivil/NomJeuneFille/@V'] = u' (%s)' % njf
252
                i['EtatCivil/NomJeuneFille/@V'] = ' (%s)' % njf
253 253
            if not i['EtatCivil/DateNaissance/@V']:
254
                i['EtatCivil/DateNaissance/@V'] = u'date de naissance inconnue'
254
                i['EtatCivil/DateNaissance/@V'] = 'date de naissance inconnue'
255 255
            ret.append(
256 256
                {
257 257
                    'id': '%(PK/IndexIndividu/@V)s' % i,
passerelle/contrib/solis_apa/suivi.py
84 84
                    intervenant['nom'] = _intervenant['Nom']['@V']
85 85
                    intervenant['prenom'] = _intervenant['Prenom']['@V']
86 86
                    coords = _intervenant.get('Coordonnees', {})
87
                    intervenant['email'] = coords.get('Email', {}).get('@V', u'')
88
                    intervenant['telephone'] = coords.get('Telephone', {}).get('@V', u'')
87
                    intervenant['email'] = coords.get('Email', {}).get('@V', '')
88
                    intervenant['telephone'] = coords.get('Telephone', {}).get('@V', '')
89 89
                    intervenants.append(intervenant)
90 90
            info['visite_intervenants'] = intervenants
91 91
            select = {}
passerelle/contrib/teamnet_axel/models.py
88 88
        streamId = operation
89 89
        xmlParams = smart_text(ET.tostring(portail, encoding='UTF-8'))
90 90
        user = ''
91
        logger.debug(u'getData(streamId=%s, xmlParams=%s, user=%s)', streamId, xmlParams, user)
91
        logger.debug('getData(streamId=%s, xmlParams=%s, user=%s)', streamId, xmlParams, user)
92 92
        result = soap.get_client(self).service.getData(streamId, smart_text(xmlParams), user)
93
        logger.debug(u'getData(%s) result: %s', streamId, smart_text(result))
93
        logger.debug('getData(%s) result: %s', streamId, smart_text(result))
94 94
        xml_result = ET.fromstring(result)
95 95
        if xml_result.find('RESULTAT/STATUS').text != 'OK':
96 96
            msg = xml_result.find('RESULTAT/COMMENTAIRES').text
passerelle/contrib/toulouse_axel/models.py
1052 1052
            activity['id'] = activity['IDACTIVITE']
1053 1053
            start_date = datetime.datetime.strptime(activity['DATEENTREE'], axel.json_date_format)
1054 1054
            end_date = datetime.datetime.strptime(activity['DATESORTIE'], axel.json_date_format)
1055
            activity['text'] = u'{} (inscription du {} au {})'.format(
1055
            activity['text'] = '{} (inscription du {} au {})'.format(
1056 1056
                activity['LIBELLEACTIVITE'],
1057 1057
                start_date.strftime(axel.xml_date_format),
1058 1058
                end_date.strftime(axel.xml_date_format),
passerelle/sms/models.py
68 68
    default_country_code = models.CharField(
69 69
        verbose_name=_('Default country code'),
70 70
        max_length=3,
71
        default=u'33',
71
        default='33',
72 72
        validators=[RegexValidator('^[0-9]*$', _('The country must only contain numbers'))],
73 73
    )
74 74
    default_trunk_prefix = models.CharField(
75 75
        verbose_name=_('Default trunk prefix'),
76 76
        max_length=2,
77
        default=u'0',
77
        default='0',
78 78
        validators=[RegexValidator('^[0-9]*$', _('The trunk prefix must only contain numbers'))],
79 79
    )  # Yeah France first !
80 80
    max_message_length = models.IntegerField(
passerelle/utils/conversion.py
92 92
            content = '<exception-while-rendering-args>'
93 93
    except AttributeError:
94 94
        content = ''
95
    return u'%s(%s)' % (e.__class__.__name__, content)
95
    return '%s(%s)' % (e.__class__.__name__, content)
96 96

  
97 97

  
98 98
def normalize(s):
passerelle/utils/xml.py
47 47
                s.append(child.tail)
48 48
        return s
49 49

  
50
    return u''.join(helper(node))
50
    return ''.join(helper(node))
51 51

  
52 52

  
53 53
def to_json(root):
tests/conftest.py
165 165
    openssl_cnf_path = tmpdir / 'openssl.cnf'
166 166
    with openssl_cnf_path.open('w') as fd:
167 167
        fd.write(
168
            u'''
168
            '''
169 169
[default_conf]
170 170
ssl_conf = ssl_sect
171 171

  
tests/test_api_entreprise.py
315 315

  
316 316
@urlmatch(netloc='^entreprise.api.gouv.fr$')
317 317
def api_entreprise_error_not_found(url, request):
318
    return response(404, {'error': 'not_found', 'message': u'Page not found'}, request=request)
318
    return response(404, {'error': 'not_found', 'message': 'Page not found'}, request=request)
319 319

  
320 320

  
321 321
@pytest.yield_fixture
tests/test_api_particulier.py
125 125
        404,
126 126
        {
127 127
            'error': 'not_found',
128
            'message': u'Les paramètres fournis sont incorrects ou ne correspondent pas à un avis',
128
            'message': 'Les paramètres fournis sont incorrects ou ne correspondent pas à un avis',
129 129
        },
130 130
        request=request,
131 131
    )
tests/test_arpege_ecp.py
72 72
def test_check_status(mocked_get, connector):
73 73
    mocked_get.return_value = tests.utils.FakedResponse(content=FAKE_HELLO_RESPONSE, status_code=200)
74 74
    resp = connector.check_status()
75
    assert resp['data'] == u'InteropAPI v1 (c) Arpège 2017'
75
    assert resp['data'] == 'InteropAPI v1 (c) Arpège 2017'
76 76

  
77 77

  
78 78
@mock.patch('passerelle.utils.Request.get')
tests/test_atal.py
85 85

  
86 86

  
87 87
def test_get_types_equipement(app, connector, monkeypatch):
88
    return_value = u"""<?xml version="1.0" encoding="UTF-8" standalone="no"?>
88
    return_value = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
89 89
    <types>
90 90
        <type id="2" label="Espaces Verts"></type>
91 91
        <type id="4" label="Voirie">
tests/test_atos_genesys.py
168 168
        assert response.json['data'][0]['id_per'] == '1234'
169 169
        assert response.json['data'][0]['dossier']
170 170
        assert response.json['data'][0]['id'] == str(link.id)
171
        assert response.json['data'][0]['text'] == u'%s - John DOE' % link.id_per
171
        assert response.json['data'][0]['text'] == '%s - John DOE' % link.id_per
172 172
        assert response.json['data'][0]['dossier']['IDENTIFICATION'][0]['CIVILITE'] == 'Madame'
173 173
        assert len(response.json['data'][0]['dossier']['DEMANDES']) == 1
174 174
        assert len(response.json['data'][0]['dossier']['DEMANDES']['AD']) == 1
......
193 193
        assert response.json['data'][0]['id_per'] == '1234'
194 194
        assert response.json['data'][0]['dossier']
195 195
        assert response.json['data'][0]['id'] == str(link.id)
196
        assert response.json['data'][0]['text'] == u'%s - John DOE' % link.id_per
196
        assert response.json['data'][0]['text'] == '%s - John DOE' % link.id_per
197 197
        assert response.json['data'][1]['id_per'] == '4567'
198 198
        assert response.json['data'][1]['dossier']
199 199
        assert response.json['data'][1]['id'] == str(link2.id)
200
        assert response.json['data'][1]['text'] == u'%s - John DOE' % link2.id_per
200
        assert response.json['data'][1]['text'] == '%s - John DOE' % link2.id_per
201 201

  
202 202
    with tests.utils.mock_url(FAKE_URL, RESPONSE_SELECT_USAGER):
203 203
        response = app.get(
......
215 215
        assert response.json['data']['id_per'] == '4567'
216 216
        assert response.json['data']['dossier']
217 217
        assert response.json['data']['id'] == str(link2.id)
218
        assert response.json['data']['text'] == u'%s - John DOE' % link2.id_per
218
        assert response.json['data']['text'] == '%s - John DOE' % link2.id_per
219 219

  
220 220

  
221 221
def test_row_locked_cache(genesys, freezer):
......
332 332
    data = response.json['data']
333 333
    assert data == [
334 334
        {
335
            u'id': u'tel1',
336
            u'id_per': u'1234',
337
            u'nom': u'DOE',
338
            u'nom_naissance': u'TEST',
339
            u'phone': u'0655555555',
340
            u'prenom': u'John',
341
            u'text': u'par SMS vers 06*****555',
335
            'id': 'tel1',
336
            'id_per': '1234',
337
            'nom': 'DOE',
338
            'nom_naissance': 'TEST',
339
            'phone': '0655555555',
340
            'prenom': 'John',
341
            'text': 'par SMS vers 06*****555',
342 342
        },
343 343
        {
344
            u'id': u'tel2',
345
            u'id_per': u'1234',
346
            u'nom': u'DOE',
347
            u'nom_naissance': u'TEST',
348
            u'phone': u'0644444444',
349
            u'prenom': u'John',
350
            u'text': u'par SMS vers 06*****444',
344
            'id': 'tel2',
345
            'id_per': '1234',
346
            'nom': 'DOE',
347
            'nom_naissance': 'TEST',
348
            'phone': '0644444444',
349
            'prenom': 'John',
350
            'text': 'par SMS vers 06*****444',
351 351
        },
352 352
        {
353
            u'email': u'test@sirus.fr',
354
            u'id': u'email1',
355
            u'id_per': u'1234',
356
            u'nom': u'DOE',
357
            u'nom_naissance': u'TEST',
358
            u'prenom': u'John',
359
            u'text': u'par courriel vers te***@***.fr',
353
            'email': 'test@sirus.fr',
354
            'id': 'email1',
355
            'id_per': '1234',
356
            'nom': 'DOE',
357
            'nom_naissance': 'TEST',
358
            'prenom': 'John',
359
            'text': 'par courriel vers te***@***.fr',
360 360
        },
361 361
    ]
362 362

  
tests/test_availability.py
6 6
import tests.utils
7 7
from passerelle.apps.feeds.models import Feed
8 8

  
9
FEED_EXAMPLE = u"""<?xml version="1.0" encoding="UTF-8"?>
9
FEED_EXAMPLE = """<?xml version="1.0" encoding="UTF-8"?>
10 10
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/">
11 11
  <title>Actualités de Strasbourg</title>
12 12
  <link rel="alternate" href="http://www.strasbourg.eu/fr/actualites/-/asset_publisher/lG7u/rss" />
tests/test_base_adresse.py
123 123
def street(db):
124 124
    return StreetModel.objects.create(
125 125
        ban_id='73001_0000',
126
        city=u'Chambéry',
127
        name=u'Une rüê très äccentuéè',
128
        zipcode=u'73000',
129
        type=u'street',
130
        citycode=u'73001',
126
        city='Chambéry',
127
        name='Une rüê très äccentuéè',
128
        zipcode='73000',
129
        type='street',
130
        citycode='73001',
131 131
        resource=BaseAdresse.objects.first(),
132 132
    )
133 133

  
......
135 135
@pytest.fixture
136 136
def region(db):
137 137
    return RegionModel.objects.create(
138
        name=u'Auvergne-Rhône-Alpes', code='84', resource=BaseAdresse.objects.first()
138
        name='Auvergne-Rhône-Alpes', code='84', resource=BaseAdresse.objects.first()
139 139
    )
140 140

  
141 141

  
142 142
@pytest.fixture
143 143
def department(db, region):
144 144
    return DepartmentModel.objects.create(
145
        name=u'Savoie', code='73', region=region, resource=BaseAdresse.objects.first()
145
        name='Savoie', code='73', region=region, resource=BaseAdresse.objects.first()
146 146
    )
147 147

  
148 148

  
149 149
@pytest.fixture
150 150
def city(db, region, department):
151 151
    return CityModel.objects.create(
152
        name=u'Chambéry',
152
        name='Chambéry',
153 153
        code='73065',
154 154
        zipcode='73000',
155 155
        population=42000,
......
162 162
@pytest.fixture
163 163
def miquelon(db):
164 164
    return CityModel.objects.create(
165
        name=u'Miquelon-Langlade',
165
        name='Miquelon-Langlade',
166 166
        code='97501',
167 167
        zipcode='97500',
168 168
        population=42,
......
244 244
    resp = app.get('/base-adresse/%s/search' % base_adresse.slug, status=400)
245 245
    assert resp.json['err'] == 1
246 246
    assert resp.json['err_class'] == 'passerelle.views.WrongParameter'
247
    assert resp.json['err_desc'] == u"missing parameters: 'q'."
247
    assert resp.json['err_desc'] == "missing parameters: 'q'."
248 248
    # json-api serializer
249 249
    resp = app.get('/base-adresse/%s/streets?zipcode=13400&coin=zz' % base_adresse.slug, status=400)
250 250
    assert resp.json['err'] == 1
......
358 358
        # create additional streets
359 359
        other_street = StreetModel.objects.create(
360 360
            ban_id='%d_000T' % (73001 + i),
361
            city=u'Chambéry',
362
            name=u'Une rue différente',
361
            city='Chambéry',
362
            name='Une rue différente',
363 363
            zipcode=str(73001 + i),
364 364
            type='street',
365 365
            citycode=str(73001 + i),
......
394 394
def test_base_adresse_streets_get_by_codes(app, base_adresse, street):
395 395
    for i in range(20):
396 396
        StreetModel.objects.create(
397
            city=u'Paris %d' % i,
398
            name=u'La rue %d' % i,
397
            city='Paris %d' % i,
398
            name='La rue %d' % i,
399 399
            zipcode=str(75000 + i * 10),
400 400
            type='street',
401 401
            citycode=str(75000 + i * 11),
......
588 588

  
589 589

  
590 590
def test_base_adresse_cities_region_department(app, base_adresse, miquelon, city):
591
    reg = RegionModel.objects.create(name=u'IdF', code='11', resource=base_adresse)
592
    dep = DepartmentModel.objects.create(name=u'Paris', code='75', region=reg, resource=base_adresse)
591
    reg = RegionModel.objects.create(name='IdF', code='11', resource=base_adresse)
592
    dep = DepartmentModel.objects.create(name='Paris', code='75', region=reg, resource=base_adresse)
593 593
    CityModel.objects.create(
594
        name=u'Paris',
594
        name='Paris',
595 595
        code='75056',
596 596
        zipcode='75014',
597 597
        population=2000000,
......
669 669

  
670 670

  
671 671
def test_base_adresse_departments_region(app, base_adresse, department):
672
    reg = RegionModel.objects.create(name=u'IdF', code='11', resource=base_adresse)
673
    DepartmentModel.objects.create(name=u'Paris', code='75', region=reg, resource=base_adresse)
672
    reg = RegionModel.objects.create(name='IdF', code='11', resource=base_adresse)
673
    DepartmentModel.objects.create(name='Paris', code='75', region=reg, resource=base_adresse)
674 674

  
675 675
    resp = app.get('/base-adresse/%s/departments?region_code=84' % base_adresse.slug)
676 676
    result = resp.json['data']
tests/test_cartads_cs.py
73 73
            },
74 74
            {
75 75
                'IdPiece': 62,
76
                'Libelle': u'Plan de masse des constructions à démolir',
76
                'Libelle': 'Plan de masse des constructions à démolir',
77 77
                'Descriptif': 'Un plan de masse des constructions...',
78 78
                'CodePiece': 'PCA1',
79 79
                'Reglementaire': False,
......
130 130
        return [
131 131
            OrderedDict(
132 132
                [
133
                    (u'CodePiece', 'PC07'),
134
                    (u'DateDemande', datetime.datetime(2019, 4, 15, 0, 0)),
135
                    (u'DatePresentation', None),
136
                    (u'DateReception', None),
137
                    (u'Descriptif', u"Un document graphique..."),
138
                    (u'IdDosPiece', 133837),
139
                    (u'IdPiece', 58),
140
                    (u'LibellePiece', u"Document graphique permettant..."),
141
                    (u'NbDocuments', 0),
133
                    ('CodePiece', 'PC07'),
134
                    ('DateDemande', datetime.datetime(2019, 4, 15, 0, 0)),
135
                    ('DatePresentation', None),
136
                    ('DateReception', None),
137
                    ('Descriptif', "Un document graphique..."),
138
                    ('IdDosPiece', 133837),
139
                    ('IdPiece', 58),
140
                    ('LibellePiece', "Document graphique permettant..."),
141
                    ('NbDocuments', 0),
142 142
                ]
143 143
            ),
144 144
            OrderedDict(
145 145
                [
146
                    (u'CodePiece', 'PC16-1'),
147
                    (u'DateDemande', datetime.datetime(2019, 4, 15, 0, 0)),
148
                    (u'DatePresentation', None),
149
                    (u'DateReception', None),
150
                    (u'Descriptif', u'Formulaire attestant...'),
151
                    (u'IdDosPiece', 133840),
152
                    (u'IdPiece', 99),
153
                    (u'LibellePiece', u'Formulaire attestant...'),
154
                    (u'NbDocuments', 0),
146
                    ('CodePiece', 'PC16-1'),
147
                    ('DateDemande', datetime.datetime(2019, 4, 15, 0, 0)),
148
                    ('DatePresentation', None),
149
                    ('DateReception', None),
150
                    ('Descriptif', 'Formulaire attestant...'),
151
                    ('IdDosPiece', 133840),
152
                    ('IdPiece', 99),
153
                    ('LibellePiece', 'Formulaire attestant...'),
154
                    ('NbDocuments', 0),
155 155
                ]
156 156
            ),
157 157
        ]
......
160 160
        return [
161 161
            OrderedDict(
162 162
                [
163
                    (u'CodePiece', 'AT1'),
164
                    (u'DateDemande', None),
165
                    (u'DatePresentation', None),
166
                    (u'DateReception', None),
167
                    (u'Descriptif', u"L'attestation constatant..."),
168
                    (u'IdDosPiece', 0),
169
                    (u'IdPiece', 191),
170
                    (u'LibellePiece', 'Attestation constat des travaux'),
171
                    (u'NbDocuments', 0),
163
                    ('CodePiece', 'AT1'),
164
                    ('DateDemande', None),
165
                    ('DatePresentation', None),
166
                    ('DateReception', None),
167
                    ('Descriptif', "L'attestation constatant..."),
168
                    ('IdDosPiece', 0),
169
                    ('IdPiece', 191),
170
                    ('LibellePiece', 'Attestation constat des travaux'),
171
                    ('NbDocuments', 0),
172 172
                ]
173 173
            ),
174 174
            OrderedDict(
175 175
                [
176
                    (u'CodePiece', 'AT2'),
177
                    (u'DateDemande', None),
178
                    (u'DatePresentation', None),
179
                    (u'DateReception', None),
180
                    (u'Descriptif', u"Dans les cas..."),
181
                    (u'IdDosPiece', 0),
182
                    (u'IdPiece', 192),
183
                    (u'LibellePiece', u'Document du...'),
184
                    (u'NbDocuments', 0),
176
                    ('CodePiece', 'AT2'),
177
                    ('DateDemande', None),
178
                    ('DatePresentation', None),
179
                    ('DateReception', None),
180
                    ('Descriptif', "Dans les cas..."),
181
                    ('IdDosPiece', 0),
182
                    ('IdPiece', 192),
183
                    ('LibellePiece', 'Document du...'),
184
                    ('NbDocuments', 0),
185 185
                ]
186 186
            ),
187 187
        ]
......
198 198
        assert id_dossier in (123, '135792')
199 199
        return OrderedDict(
200 200
            [
201
                (u'AdresseTerrain', u'all\xe9e des Fleurs'),
202
                (u'CoTypeDossier', 'PC'),
203
                (u'Commune', u'AIGREFEUILLE SUR MAINE'),
204
                (u'DateDepot', datetime.datetime(2019, 9, 19, 0, 0)),
205
                (u'IdDossier', 478864),
206
                (u'NomDossier', 'PC 069 085 19 00010'),
207
                (u'TypeDossier', 'Permis de construire'),
201
                ('AdresseTerrain', 'all\xe9e des Fleurs'),
202
                ('CoTypeDossier', 'PC'),
203
                ('Commune', 'AIGREFEUILLE SUR MAINE'),
204
                ('DateDepot', datetime.datetime(2019, 9, 19, 0, 0)),
205
                ('IdDossier', 478864),
206
                ('NomDossier', 'PC 069 085 19 00010'),
207
                ('TypeDossier', 'Permis de construire'),
208 208
            ]
209 209
        )
210 210

  
......
266 266
    assert len(data) == 5
267 267
    assert data[0]['text'] == 'Cerfa rempli'
268 268
    assert data[0]['max_files'] == 1
269
    assert data[1]['text'] == u'Cerfa demandeurs complémentaires'
269
    assert data[1]['text'] == 'Cerfa demandeurs complémentaires'
270 270
    assert data[1]['max_files'] == 6
271 271
    assert data[2]['text'] == 'Plan de situation du terrain'
272 272
    assert data[2]['max_files'] == 6
......
484 484
    resp = app.get('/cartads-cs/test/status?dossier_id=%s' % dossier.id)
485 485
    assert (
486 486
        resp.json['status_label']
487
        == u"File refused (Le modèle sélectionné ne correspond à aucun Cerfa géré par l'application.)"
487
        == "File refused (Le modèle sélectionné ne correspond à aucun Cerfa géré par l'application.)"
488 488
    )
489 489

  
490 490

  
......
496 496
    dossier.zip_ack_response = 'False'
497 497
    dossier.save()
498 498
    resp = app.get('/cartads-cs/test/status?dossier_id=%s' % dossier.id)
499
    assert resp.json['status_label'] == u"File not considered"
499
    assert resp.json['status_label'] == "File not considered"
500 500

  
501 501

  
502 502
def test_additional_pieces_management(connector, app, cached_data):
......
510 510
    assert len(data) == 2
511 511
    assert data[0]['text'] == 'Document graphique permettant...'
512 512
    assert data[0]['max_files'] == 6
513
    assert data[1]['text'] == u'Formulaire attestant...'
513
    assert data[1]['text'] == 'Formulaire attestant...'
514 514
    assert data[1]['max_files'] == 6
515 515
    for piece in data:
516 516
        assert len(piece['files']) == 1
tests/test_csv_datasource.py
245 245

  
246 246

  
247 247
def test_unicode_filter_data(client, setup, filetype):
248
    filter_criteria = u'Benoît'
248
    filter_criteria = 'Benoît'
249 249
    _, url = setup(',id,,text,', filename=filetype, data=get_file_content(filetype))
250 250
    filters = {'text': filter_criteria}
251 251
    resp = client.get(url, filters)
......
259 259

  
260 260
def test_unicode_case_insensitive_filter_data(client, setup, filetype):
261 261
    _, url = setup(',id,,text,', filename=filetype, data=get_file_content(filetype))
262
    filter_criteria = u'anaëlle'
262
    filter_criteria = 'anaëlle'
263 263
    filters = {'text': filter_criteria, 'case-insensitive': ''}
264 264
    resp = client.get(url, filters)
265 265
    result = parse_response(resp)
tests/test_dpark.py
94 94
        elif self.error_class is TransportError:
95 95
            raise self.error_class('connection error occured', None)
96 96
        elif self.error_class is WebFaultHavingLatin1:
97
            raise WebFault(message=u'éêè')
97
            raise WebFault(message='éêè')
98 98
        else:
99 99
            raise Exception('random error')
100 100

  
......
129 129
        assert 'Error: random error' in resp.json['err_desc']
130 130
        client.return_value = get_client(error_class=WebFaultHavingLatin1)
131 131
        resp = app.get('/dpark/test/ping/')
132
        assert u'ServiceError: éêè' in resp.json['err_desc']
132
        assert 'ServiceError: éêè' in resp.json['err_desc']
133 133

  
134 134

  
135 135
def test_ping(dpark, app):
......
156 156
        assert resp.json['code'] == 'unknown-file'
157 157
        # invalid cardnumber
158 158
        client.return_value = get_client(
159
            replydata={'CodeRetour': '04', 'MessageRetour': u'Numéro de support inconnu'}
159
            replydata={'CodeRetour': '04', 'MessageRetour': 'Numéro de support inconnu'}
160 160
        )
161 161
        resp = app.get('/dpark/test/search/', params=params)
162 162
        assert resp.json['err'] == 1
......
184 184
        assert resp.json['code'] == 'unknown-file'
185 185
        # invalid cardnumber
186 186
        client.return_value = get_client(
187
            replydata={'CodeRetour': '04', 'MessageRetour': u'Numéro de support inconnu'}
187
            replydata={'CodeRetour': '04', 'MessageRetour': 'Numéro de support inconnu'}
188 188
        )
189 189
        resp = app.post_json('/dpark/test/link/', params=params)
190 190
        assert resp.json['err'] == 1
......
420 420
        url = '/dpark/test/check-renewal-time/'
421 421
        params = {'firstnames': 'spam eggs', 'lastname': 'bar', 'filenumber': '1' * 9, 'badgenumber': '2' * 9}
422 422
        client.return_value = get_client(
423
            replydata={'CodeRetour': '02', 'MessageRetour': u'Renouvellement hors délai'}
423
            replydata={'CodeRetour': '02', 'MessageRetour': 'Renouvellement hors délai'}
424 424
        )
425 425
        resp = app.get(url, params=params)
426 426
        assert resp.json['data'] is False
427
        assert resp.json['desc'] == u'Renouvellement hors délai'
427
        assert resp.json['desc'] == 'Renouvellement hors délai'
428 428
        client.return_value = get_client(replydata={'CodeRetour': '01', 'MessageRetour': 'Dossier existant'})
429 429
        resp = app.get(url, params=params)
430 430
        assert resp.json['data'] is True
......
435 435
        url = '/dpark/test/check-renewal-time/'
436 436
        params = {'firstnames': 'spam eggs', 'lastname': 'bar', 'filenumber': '1' * 9, 'badgenumber': '2' * 9}
437 437
        client.return_value = get_client(
438
            replydata={'CodeRetour': '02', 'MessageRetour': u'Demande déjà en cours'}
438
            replydata={'CodeRetour': '02', 'MessageRetour': 'Demande déjà en cours'}
439 439
        )
440 440
        resp = app.get(url, params=params)
441 441
        assert resp.json['data'] is False
442
        assert resp.json['desc'] == u'Demande déjà en cours'
442
        assert resp.json['desc'] == 'Demande déjà en cours'
443 443
        client.return_value = get_client(replydata={'CodeRetour': '01', 'MessageRetour': 'Dossier existant'})
444 444
        resp = app.get(url, params=params)
445 445
        assert resp.json['data'] is True
......
459 459
            'applicant_lastname': 'Ham',
460 460
        }
461 461
        client.return_value = get_client(
462
            replydata={'CodeRetour': '02', 'MessageRetour': u'Demande déjà en cours'}
462
            replydata={'CodeRetour': '02', 'MessageRetour': 'Demande déjà en cours'}
463 463
        )
464 464
        resp = app.get(url, params=params)
465 465
        assert resp.json['data'] is False
466
        assert resp.json['desc'] == u'Demande déjà en cours'
466
        assert resp.json['desc'] == 'Demande déjà en cours'
467 467
        client.return_value = get_client(replydata={'CodeRetour': '01', 'MessageRetour': ''})
468 468
        resp = app.get(url, params=params)
469 469
        assert resp.json['data'] is True
......
483 483
            'applicant_lastname': 'Ham',
484 484
        }
485 485
        client.return_value = get_client(
486
            replydata={'CodeRetour': '02', 'MessageRetour': u'Usager existe déjà dans D-Park'}
486
            replydata={'CodeRetour': '02', 'MessageRetour': 'Usager existe déjà dans D-Park'}
487 487
        )
488 488
        resp = app.get(url, params=params)
489 489
        assert resp.json['data'] is False
490
        assert resp.json['desc'] == u'Usager existe déjà dans D-Park'
490
        assert resp.json['desc'] == 'Usager existe déjà dans D-Park'
491 491
        client.return_value = get_client(replydata={'CodeRetour': '01', 'MessageRetour': ''})
492 492
        resp = app.get(url, params=params)
493 493
        assert resp.json['data'] is True
......
508 508
            'badgenumber': '2' * 9,
509 509
        }
510 510
        Pairing.objects.create(resource=dpark, **params)
511
        client.return_value = get_client(replydata={'CodeRetour': '02', 'MessageRetour': u'Dossier inconnu'})
511
        client.return_value = get_client(replydata={'CodeRetour': '02', 'MessageRetour': 'Dossier inconnu'})
512 512
        resp = app.get(url)
513 513
        assert resp.json['err'] == 0
514 514
        assert resp.json['data'] == []
515 515
        replydata = {
516 516
            'CodeRetour': '01',
517
            'MessageRetour': u'Demande acceptée',
517
            'MessageRetour': 'Demande acceptée',
518 518
            'NumeroDemande': '55555',
519 519
            'Montant': 12500,
520 520
            'TypePaiement': 10,
......
568 568
                'badgenumber': '2' * 9,
569 569
            },
570 570
        )
571
        operation.return_value = mock.Mock(CodeRetour='02', MessageRetour=u'Dossier inconnu')
571
        operation.return_value = mock.Mock(CodeRetour='02', MessageRetour='Dossier inconnu')
572 572
        resp = app.post_json(url, params=params)
573 573
        assert operation.call_args_list[-1].args[5] == expected_date
574 574
        assert resp.json['err'] == 1
......
630 630
    )
631 631
    assert demande_abonnementtiers in force_text(dpark.mock_requests[0].body)
632 632
    assert resp.json['err'] == 1
633
    assert resp.json['err_desc'] == u'Dossier incomplet'
633
    assert resp.json['err_desc'] == 'Dossier incomplet'
634 634
    # with complete application
635 635
    dpark.mock_responses.append(
636 636
        """<?xml version="1.0" encoding="utf-8"?>
......
668 668
        soap_call.side_effect = APIError('Numéro de demande introuvable')
669 669
        resp = app.post_json(url, params=params)
670 670
        assert resp.json['err'] == 1
671
        assert resp.json['err_desc'] == u'Numéro de demande introuvable'
671
        assert resp.json['err_desc'] == 'Numéro de demande introuvable'
672 672

  
673 673
    params['justif_domicile'] = {
674 674
        'filename': 'address_proof.pDf',
......
699 699
    params['impot_revenu'] = 'this is my tax notice'
700 700
    resp = app.post_json(url, params=params)
701 701
    errors = [
702
        u"<impot_revenu> value is not a dict",
703
        u"<taxe_habitat> <content> is either absent or has an invalid value",
704
        u"<taxe_habitat,2> <filename> is either absent or has an invalid value",
705
        u"Invalid document type: <toto,6>",
702
        "<impot_revenu> value is not a dict",
703
        "<taxe_habitat> <content> is either absent or has an invalid value",
704
        "<taxe_habitat,2> <filename> is either absent or has an invalid value",
705
        "Invalid document type: <toto,6>",
706 706
    ]
707 707
    assert resp.json['err'] == 1
708 708
    assert resp.json['err_desc'] == '%s' % errors
tests/test_feeds.py
6 6
import tests.utils
7 7
from passerelle.apps.feeds.models import Feed
8 8

  
9
FEED_EXAMPLE = u"""<?xml version="1.0" encoding="UTF-8"?>
9
FEED_EXAMPLE = """<?xml version="1.0" encoding="UTF-8"?>
10 10
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/">
11 11
  <title>Actualités de Strasbourg</title>
12 12
  <link rel="alternate" href="http://www.strasbourg.eu/fr/actualites/-/asset_publisher/lG7u/rss" />
tests/test_gdema.py
79 79
        assert resp.json['err'] == 0
80 80
        assert len(resp.json['data']) == 3
81 81
        assert resp.json['data'][0]['id'] == '16151'
82
        assert resp.json['data'][0]['text'] == u'DMT - Mobilité et transports'
82
        assert resp.json['data'][0]['text'] == 'DMT - Mobilité et transports'
83 83

  
84 84
        resp = app.get(endpoint + '/typology/', status=200)
85 85
        assert requests_get.call_count == 2
......
87 87
        assert resp.json['err'] == 0
88 88
        assert len(resp.json['data']) == 12
89 89
        assert resp.json['data'][0]['id'] == '13067'
90
        assert resp.json['data'][0]['text'] == u'Maintenance Cie'
90
        assert resp.json['data'][0]['text'] == 'Maintenance Cie'
91 91
        assert resp.json['data'][0]['service_id'] == '10173'
92 92
        assert (
93 93
            resp.json['data'][0]['service_text']
94
            == u'DESPU - Administration Direction environnement et services publics urbains'
94
            == 'DESPU - Administration Direction environnement et services publics urbains'
95 95
        )
96 96

  
97 97
        resp = app.get(endpoint + '/typology/?service_id=10426', status=200)
......
100 100
        assert resp.json['err'] == 0
101 101
        assert len(resp.json['data']) == 7
102 102
        assert resp.json['data'][0]['id'] == '10804'
103
        assert resp.json['data'][0]['text'] == u'Activités périscolaires'
103
        assert resp.json['data'][0]['text'] == 'Activités périscolaires'
104 104
        assert resp.json['data'][0]['service_id'] == '10426'
105
        assert resp.json['data'][0]['service_text'] == u'DEE - Périscolaire et éducatif'
105
        assert resp.json['data'][0]['service_text'] == 'DEE - Périscolaire et éducatif'
106 106

  
107 107

  
108 108
def test_gdema_referentiel(app, gdema):
......
143 143
        assert resp.json['err'] == 0
144 144
        assert resp.json['data']['Id'] == '1'
145 145
        assert resp.json['data']['AnswerToProvide'] is True
146
        assert resp.json['data']['Description'].startswith(u'contrôle')
146
        assert resp.json['data']['Description'].startswith('contrôle')
147 147
        assert resp.json['data']['ExpectedDate'] is None
148 148
        assert resp.json['data']['Files'] == []
149 149
        assert resp.json['data']['Handler']['CivilityId'] == '0'
......
158 158
        assert requests_get.call_args[0][0] == 'https://gdema.example.net/api/request/1/state'
159 159
        assert 'data' in resp.json
160 160
        assert resp.json['err'] == 0
161
        assert resp.json['data'] == {'Id': '1', 'State': '64', 'StateLabel': u'Cloturée'}
161
        assert resp.json['data'] == {'Id': '1', 'State': '64', 'StateLabel': 'Cloturée'}
162 162

  
163 163

  
164 164
def test_gdema_create_request(app, gdema):
tests/test_generic_endpoint.py
128 128
    assert record.levelno == 20
129 129
    assert record.levelname == 'INFO'
130 130
    assert record.name == 'passerelle.resource.arcgis.test'
131
    assert u"endpoint GET /arcgis/test/mapservice-query?" in record.message
131
    assert "endpoint GET /arcgis/test/mapservice-query?" in record.message
132 132
    assert not hasattr(record, 'connector_result')
133 133
    record = caplog.records[1]
134 134
    assert record.levelno == 10
135 135
    assert record.levelname == 'DEBUG'
136 136
    assert record.name == 'passerelle.resource.arcgis.test'
137
    assert u"endpoint GET /arcgis/test/mapservice-query?" in record.message
137
    assert "endpoint GET /arcgis/test/mapservice-query?" in record.message
138 138
    assert hasattr(record, 'connector_result')
139 139

  
140 140
    data = resp.json['data']
......
434 434
    with patch_init, patch_object:
435 435
        resp = app.post_json(url_foo, params=payload, status=400)
436 436
    assert resp.json['err'] == 1
437
    assert resp.json['err_desc'] == "foo/1/id: None is not of type %s" % repr(u'integer')
437
    assert resp.json['err_desc'] == "foo/1/id: None is not of type %s" % repr('integer')
438 438
    with patch_init, patch_object:
439 439
        resp = app.post_json(url_bar, params=payload)
440 440
    assert resp.json['err'] == 0
tests/test_grenoble_gru.py
226 226
    with mock.patch('passerelle.utils.Request.post') as request_post:
227 227
        request_post.return_value = get_typo_response()
228 228
        payload = BASIC_PAYLOAD.copy()
229
        payload['intervention_free_address'] = u'169, rue du Château'
230
        payload['applicant_free_address'] = u'1, rue de l\'Est'
229
        payload['intervention_free_address'] = '169, rue du Château'
230
        payload['applicant_free_address'] = '1, rue de l\'Est'
231 231
        app.post_json(
232 232
            reverse(
233 233
                'generic-endpoint',
......
235 235
            ),
236 236
            params=payload,
237 237
        )
238
        assert request_post.call_args[1]['data']['int_adresse_manuelle'] == u'169, rue du Château'
239
        assert request_post.call_args[1]['data']['dem_adresse_manuelle'] == u'1, rue de l\'Est'
238
        assert request_post.call_args[1]['data']['int_adresse_manuelle'] == '169, rue du Château'
239
        assert request_post.call_args[1]['data']['dem_adresse_manuelle'] == '1, rue de l\'Est'
240 240
        assert request_post.call_args[1]['data']['obs_demande_urgente'] == 1
241 241
        assert request_post.call_args[1]['data']['dem_comp'] == 'Voirie'
242
        assert request_post.call_args[1]['data']['dem_pav'] == u'déchetterie'
242
        assert request_post.call_args[1]['data']['dem_pav'] == 'déchetterie'
243 243
        assert request_post.call_args[1]['data']['dem_reponse'] == 0
244 244
        assert request_post.call_args[1]['data']['obs_description_probleme'] == 'thank you '
245 245

  
tests/test_iws.py
52 52
    )
53 53
    json_result = response.json_body
54 54
    assert json_result['err'] == 1
55
    assert u'DECHET' in json_result['err_desc']
56
    assert u'ENCOMBRANT' in json_result['err_desc']
55
    assert 'DECHET' in json_result['err_desc']
56
    assert 'ENCOMBRANT' in json_result['err_desc']
57 57

  
58 58

  
59 59
def test_checkdate_sti_code_optionnal_last_char(app, setup, endpoint_dummy_cache, monkeypatch):
tests/test_lille_kimoce.py
321 321
        'companyLocation': {'number': '', 'road': '', 'zipCode': '', 'city': ''},
322 322
        'pictures': [],
323 323
        'subType': '/api/sub_types/164',
324
        'sourceContact': {'firstname': 'Foo', 'mail': 'foo@example.net', 'lastname': u'Bar'},
324
        'sourceContact': {'firstname': 'Foo', 'mail': 'foo@example.net', 'lastname': 'Bar'},
325 325
    }
326 326
    assert response.json['data'] == json.loads(DEMAND_CREATION_RESPONSE)
327 327
    assert mocked_post.call_count == 2
tests/test_okina.py
1686 1686
        assert resp.json['err'] == 0
1687 1687
        assert len(resp.json['data']) == 4
1688 1688
        assert resp.json['data'][0]['id'] == '1'
1689
        assert resp.json['data'][0]['text'] == u'École maternelle - Petite section'
1689
        assert resp.json['data'][0]['text'] == 'École maternelle - Petite section'
1690 1690

  
1691 1691

  
1692 1692
def test_okina_institutions(app, okina):
......
1700 1700
            assert resp.json['err'] == 0
1701 1701
            assert len(resp.json['data']) == 2
1702 1702
            assert resp.json['data'][0]['id'] == '277'
1703
            assert resp.json['data'][0]['text'] == u'Collège Touvent'
1703
            assert resp.json['data'][0]['text'] == 'Collège Touvent'
1704 1704
            assert resp.json['data'][0]['lat'] == '46.791332586468016'
1705 1705
            assert resp.json['data'][0]['lon'] == '1.6926355997775921'
1706 1706

  
......
1711 1711
            assert resp.json['err'] == 0
1712 1712
            assert len(resp.json['data']) == 2
1713 1713
            assert resp.json['data'][0]['id'] == '277'
1714
            assert resp.json['data'][0]['text'] == u'Collège Touvent'
1714
            assert resp.json['data'][0]['text'] == 'Collège Touvent'
1715 1715

  
1716 1716
            resp = app.get(endpoint + '/from-city/36005/', status=200)
1717 1717
            assert (
......
1721 1721
            assert resp.json['err'] == 0
1722 1722
            assert len(resp.json['data']) == 2
1723 1723
            assert resp.json['data'][0]['id'] == '277'
1724
            assert resp.json['data'][0]['text'] == u'Collège Touvent'
1724
            assert resp.json['data'][0]['text'] == 'Collège Touvent'
1725 1725

  
1726 1726

  
1727 1727
def test_okina_search(app, okina):
......
1783 1783
        assert resp.json['err'] == 0
1784 1784
        assert len(resp.json['data']) == 3
1785 1785
        assert resp.json['data'][0]['id'] == '3281'
1786
        assert resp.json['data'][0]['text'] == u'Les Loges de Dressais'
1786
        assert resp.json['data'][0]['text'] == 'Les Loges de Dressais'
1787 1787

  
1788 1788

  
1789 1789
def test_okina_ods(app, okina):
......
1846 1846
        assert len(resp.json['data']) == 1
1847 1847
        assert resp.json['data'][0]['id'] == 'inst:276-seq:1-6-84'
1848 1848
        assert (
1849
            resp.json['data'][0]['text'] == u'Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent'
1849
            resp.json['data'][0]['text'] == 'Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent'
1850 1850
        )
1851 1851
        assert resp.json['data'][0]['identifier'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
1852 1852
        assert resp.json['data'][0]['vehicle_journey_id'] == '84'
......
1858 1858
        assert len(resp.json['data']) == 1
1859 1859
        assert resp.json['data'][0]['id'] == 'inst:276-seq:1-6-84'
1860 1860
        assert (
1861
            resp.json['data'][0]['text'] == u'Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent'
1861
            resp.json['data'][0]['text'] == 'Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent'
1862 1862
        )
1863 1863
        assert resp.json['data'][0]['identifier'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
1864 1864
        assert resp.json['data'][0]['vehicle_journey_id'] == '84'
......
1882 1882
        assert resp.json['err'] == 0
1883 1883
        assert len(resp.json['data']) == 1
1884 1884
        assert resp.json['data'][0]['id'] == '2'
1885
        assert resp.json['data'][0]['text'] == u'réseau scolaire'
1885
        assert resp.json['data'][0]['text'] == 'réseau scolaire'
1886 1886

  
1887 1887
        requests_get.return_value = tests.utils.FakedResponse(content=VEHICLE_JOURNEYS, status_code=200)
1888 1888
        resp = app.get(endpoint + '/vehicle-journeys/', status=200)
......
1890 1890
        assert resp.json['err'] == 0
1891 1891
        assert len(resp.json['data']) == 3
1892 1892
        assert resp.json['data'][0]['id'] == '306'
1893
        assert resp.json['data'][0]['text'] == u'019 02 - VELLES LYCEES DE CHATEAUROUX'
1893
        assert resp.json['data'][0]['text'] == '019 02 - VELLES LYCEES DE CHATEAUROUX'
1894 1894

  
1895 1895

  
1896 1896
def test_okina_errors(app, okina):
tests/test_opendatasoft.py
50 50
                    "nom_rue": "RUE DE L'AUBEPINE",
51 51
                    "num_com": 482,
52 52
                    "numero": "33",
53
                    "source": u"Ville et Eurométropole de Strasbourg",
53
                    "source": "Ville et Eurométropole de Strasbourg",
54 54
                },
55 55
                "geometry": {"coordinates": [7.76978279836, 48.6060963542], "type": "Point"},
56 56
                "record_timestamp": "2019-12-02T14:15:08.376000+00:00",
......
66 66
                    "nom_rue": "RUE DE L'AUBEPINE",
67 67
                    "num_com": 268,
68 68
                    "numero": "19",
69
                    "source": u"Ville et Eurométropole de Strasbourg",
69
                    "source": "Ville et Eurométropole de Strasbourg",
70 70
                },
71 71
                "geometry": {"coordinates": [7.66177412454, 48.4920620548], "type": "Point"},
72 72
                "record_timestamp": "2019-12-02T14:15:08.376000+00:00",
......
82 82
                    "nom_rue": "RUE DE L'AUBEPINE",
83 83
                    "num_com": 482,
84 84
                    "numero": "29",
85
                    "source": u"Ville et Eurométropole de Strasbourg",
85
                    "source": "Ville et Eurométropole de Strasbourg",
86 86
                },
87 87
                "geometry": {"coordinates": [7.76988497729, 48.6056497224], "type": "Point"},
88 88
                "record_timestamp": "2019-12-02T14:15:08.376000+00:00",
......
113 113
                    "nom_rue": "RUE DE L'AUBEPINE",
114 114
                    "num_com": 268,
115 115
                    "numero": "19",
116
                    u"source": "Ville et Eurométropole de Strasbourg",
116
                    "source": "Ville et Eurométropole de Strasbourg",
117 117
                },
118 118
                "geometry": {"coordinates": [7.66177412454, 48.4920620548], "type": "Point"},
119 119
                "record_timestamp": "2019-12-02T14:15:08.376000+00:00",
tests/test_opengis.py
142 142
    "type": "FeatureCollection"
143 143
}'''
144 144

  
145
FAKE_ERROR = u'''<ows:ExceptionReport
145
FAKE_ERROR = '''<ows:ExceptionReport
146 146
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
147 147
     xmlns:ows="http://www.opengis.net/ows/1.1"
148 148
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
tests/test_photon.py
147 147
    resp = app.get('/photon/%s/search' % photon.slug, status=400)
148 148
    assert resp.json['err'] == 1
149 149
    assert resp.json['err_class'] == 'passerelle.views.WrongParameter'
150
    assert resp.json['err_desc'] == u"missing parameters: 'q'."
150
    assert resp.json['err_desc'] == "missing parameters: 'q'."
151 151

  
152 152

  
153 153
@mock.patch('passerelle.utils.Request.get')
tests/test_planitech.py
520 520
            'some_custom_field': None,
521 521
        },
522 522
        '3': {
523
            u'capacity': 30,
524
            u'label': u'salle 3',
525
            u'identifier': 3,
523
            'capacity': 30,
524
            'label': 'salle 3',
525
            'identifier': 3,
526 526
            'street_number': None,
527 527
            'address': None,
528 528
            'city': None,
......
530 530
            'some_custom_field': 'Yes',
531 531
        },
532 532
        '2': {
533
            u'capacity': 20,
534
            u'label': u'salle 2',
535
            u'identifier': 2,
533
            'capacity': 20,
534
            'label': 'salle 2',
535
            'identifier': 2,
536 536
            'street_number': None,
537 537
            'address': None,
538 538
            'city': None,
......
540 540
            'some_custom_field': 'Yes',
541 541
        },
542 542
        '1': {
543
            u'capacity': 10,
544
            u'label': u'salle 1',
545
            u'identifier': 1,
543
            'capacity': 10,
544
            'label': 'salle 1',
545
            'identifier': 1,
546 546
            'street_number': 1,
547 547
            'address': 'rue planitech',
548 548
            'city': 'thecity',
......
557 557
    response = app.get('/planitech/slug-planitech/getplacesreferential?some_custom_field=Yes')
558 558
    assert response.json['data'] == {
559 559
        '3': {
560
            u'capacity': 30,
561
            u'label': u'salle 3',
562
            u'identifier': 3,
560
            'capacity': 30,
561
            'label': 'salle 3',
562
            'identifier': 3,
563 563
            'street_number': None,
564 564
            'address': None,
565 565
            'city': None,
......
567 567
            'some_custom_field': 'Yes',
568 568
        },
569 569
        '2': {
570
            u'capacity': 20,
571
            u'label': u'salle 2',
572
            u'identifier': 2,
570
            'capacity': 20,
571
            'label': 'salle 2',
572
            'identifier': 2,
573 573
            'street_number': None,
574 574
            'address': None,
575 575
            'city': None,
......
585 585
    )
586 586
    assert response.json['data'] == {
587 587
        '3': {
588
            u'capacity': 30,
589
            u'label': u'salle 3',
590
            u'identifier': 3,
588
            'capacity': 30,
589
            'label': 'salle 3',
590
            'identifier': 3,
591 591
            'street_number': None,
592 592
            'address': None,
593 593
            'city': None,
......
610 610
            'some_custom_field': None,
611 611
        },
612 612
        '3': {
613
            u'capacity': 30,
614
            u'label': u'salle 3',
615
            u'identifier': 3,
613
            'capacity': 30,
614
            'label': 'salle 3',
615
            'identifier': 3,
616 616
            'street_number': None,
617 617
            'address': None,
618 618
            'city': None,
......
620 620
            'some_custom_field': 'Yes',
621 621
        },
622 622
        '2': {
623
            u'capacity': 20,
624
            u'label': u'salle 2',
625
            u'identifier': 2,
623
            'capacity': 20,
624
            'label': 'salle 2',
625
            'identifier': 2,
626 626
            'street_number': None,
627 627
            'address': None,
628 628
            'city': None,
......
630 630
            'some_custom_field': 'Yes',
631 631
        },
632 632
        '1': {
633
            u'capacity': 10,
634
            u'label': u'salle 1',
635
            u'identifier': 1,
633
            'capacity': 10,
634
            'label': 'salle 1',
635
            'identifier': 1,
636 636
            'street_number': 1,
637 637
            'address': 'rue planitech',
638 638
            'city': 'thecity',
......
665 665
    mock_planitech(monkeypatch, side_effect=side_effect)
666 666
    response = app.get('/planitech/slug-planitech/getplace?id=2')
667 667
    assert response.json['data'] == {
668
        u'capacity': 20,
669
        u'label': u'salle 2',
670
        u'identifier': 2,
668
        'capacity': 20,
669
        'label': 'salle 2',
670
        'identifier': 2,
671 671
        'street_number': None,
672 672
        'address': None,
673 673
        'city': None,
......
715 715
    response = app.get('/planitech/slug-planitech/getplacesreferential')
716 716
    expected_res = {
717 717
        '2': {
718
            u'capacity': 20,
719
            u'label': u'salle 2',
720
            u'identifier': 2,
718
            'capacity': 20,
719
            'label': 'salle 2',
720
            'identifier': 2,
721 721
            'street_number': None,
722 722
            'address': None,
723 723
            'city': None,
724 724
            'zipcode': None,
725 725
        },
726 726
        '1': {
727
            u'capacity': 10,
728
            u'label': u'salle 1',
729
            u'identifier': 1,
727
            'capacity': 10,
728
            'label': 'salle 1',
729
            'identifier': 1,
730 730
            'street_number': 1,
731 731
            'address': 'rue planitech',
732 732
            'city': 'thecity',
......
813 813
def freegaps_data():
814 814
    referential = collections.OrderedDict(
815 815
        [
816
            (1.0, {u'capacity': 10.0, u'label': u'salle 1', u'identifier': 1.0}),
816
            (1.0, {'capacity': 10.0, 'label': 'salle 1', 'identifier': 1.0}),
817 817
            (
818 818
                2.0,
819
                {u'capacity': 20.0, u'label': u'salle 2', u'identifier': 2.0, u'some_custom_field': u'Yes'},
819
                {'capacity': 20.0, 'label': 'salle 2', 'identifier': 2.0, 'some_custom_field': 'Yes'},
820 820
            ),
821 821
            (
822 822
                3.0,
823
                {u'capacity': 30.0, u'label': u'salle 3', u'identifier': 3.0, u'some_custom_field': u'Yes'},
823
                {'capacity': 30.0, 'label': 'salle 3', 'identifier': 3.0, 'some_custom_field': 'Yes'},
824 824
            ),
825 825
        ]
826 826
    )
......
868 868
        '&start_date=2018-11-11&display=date'
869 869
    )
870 870
    assert response.json['data'] == [
871
        {u'id': u'2018-11-11', u'text': u'dimanche 11 novembre 2018', u'short_text': '11/11/2018'},
872
        {u'id': u'2018-11-12', u'text': u'lundi 12 novembre 2018', u'short_text': '12/11/2018'},
873
        {u'id': u'2018-11-13', u'text': u'mardi 13 novembre 2018', u'short_text': '13/11/2018'},
871
        {'id': '2018-11-11', 'text': 'dimanche 11 novembre 2018', 'short_text': '11/11/2018'},
872
        {'id': '2018-11-12', 'text': 'lundi 12 novembre 2018', 'short_text': '12/11/2018'},
873
        {'id': '2018-11-13', 'text': 'mardi 13 novembre 2018', 'short_text': '13/11/2018'},
874 874
    ]
875 875

  
876 876
    # place display
......
878 878
        '/planitech/slug-planitech/getfreegaps?start_time=10:00&&end_time=11:00'
879 879
        '&start_date=2018-11-11&display=place'
880 880
    )
881
    assert response.json['data'] == [{u'id': 1.0, u'text': u'salle 1'}, {u'id': 2.0, u'text': u'salle 2'}]
881
    assert response.json['data'] == [{'id': 1.0, 'text': 'salle 1'}, {'id': 2.0, 'text': 'salle 2'}]
882 882

  
883 883
    # full display
884 884
    response = app.get(
......
893 893

  
894 894
    place_1 = full[0]
895 895
    assert place_1['id'] == 1.0
896
    assert place_1['text'] == u'salle 1'
896
    assert place_1['text'] == 'salle 1'
897 897
    assert place_1['dates'] == [
898
        {u'available': True, u'id': u'2018-11-11'},
899
        {u'available': True, u'id': u'2018-11-12'},
900
        {u'available': False, u'id': u'2018-11-13'},
898
        {'available': True, 'id': '2018-11-11'},
899
        {'available': True, 'id': '2018-11-12'},
900
        {'available': False, 'id': '2018-11-13'},
901 901
    ]
902 902

  
903 903
    place_2 = full[1]
904 904
    assert place_2['id'] == 2.0
905
    assert place_2['text'] == u'salle 2'
905
    assert place_2['text'] == 'salle 2'
906 906
    assert place_2['dates'] == [
907
        {u'available': True, u'id': u'2018-11-11'},
908
        {u'available': True, u'id': u'2018-11-12'},
909
        {u'available': True, u'id': u'2018-11-13'},
907
        {'available': True, 'id': '2018-11-11'},
908
        {'available': True, 'id': '2018-11-12'},
909
        {'available': True, 'id': '2018-11-13'},
910 910
    ]
911 911

  
912 912
    place_3 = full[2]
913 913
    assert place_3['id'] == 3.0
914
    assert place_3['text'] == u'salle 3'
914
    assert place_3['text'] == 'salle 3'
915 915
    assert place_3['dates'] == [
916
        {u'available': False, u'id': u'2018-11-11'},
917
        {u'available': False, u'id': u'2018-11-12'},
918
        {u'available': False, u'id': u'2018-11-13'},
916
        {'available': False, 'id': '2018-11-11'},
917
        {'available': False, 'id': '2018-11-12'},
918
        {'available': False, 'id': '2018-11-13'},
919 919
    ]
920 920

  
921 921
    # general params interpretation
tests/test_proxylogger.py
43 43

  
44 44
def test_proxy_logger_basic(db, connector):
45 45
    pr = ProxyLogger(connector)
46
    pr.debug(u'some message')
46
    pr.debug('some message')
47 47
    rl_query = ResourceLog.objects.all()
48 48
    assert len(rl_query) == 1
49 49
    rl = rl_query.first()
50
    assert rl.message == u'some message'
50
    assert rl.message == 'some message'
51 51
    assert rl.levelno == logging.DEBUG
52
    assert rl.appname == u'feeds'
53
    assert rl.slug == u'some-slug'
52
    assert rl.appname == 'feeds'
53
    assert rl.slug == 'some-slug'
54 54

  
55 55

  
56 56
def test_proxy_logger_std_interpolation(db, connector):
57 57
    ResourceLog.objects.all().delete()
58 58
    pr = ProxyLogger(connector)
59
    pr.debug(u'some message %s', u'some var')
59
    pr.debug('some message %s', 'some var')
60 60
    rl_query = ResourceLog.objects.all()
61 61
    rl = rl_query.first()
62
    assert rl.message == u'some message some var'
62
    assert rl.message == 'some message some var'
63 63

  
64 64

  
65 65
def test_proxy_logger_dict_interpolation(db, connector):
66 66
    ResourceLog.objects.all().delete()
67 67
    pr = ProxyLogger(connector)
68
    pr.debug(u'some message %(var_name)s', {u'var_name': u'some var'})
68
    pr.debug('some message %(var_name)s', {'var_name': 'some var'})
69 69
    rl_query = ResourceLog.objects.all()
70 70
    rl = rl_query.first()
71
    assert rl.message == u'some message some var'
71
    assert rl.message == 'some message some var'
72 72

  
73 73

  
74 74
def test_proxy_logger_ignore(db, connector):
75 75
    ResourceLog.objects.all().delete()
76 76
    connector.set_log_level('INFO')
77 77
    pr = ProxyLogger(connector)
78
    pr.debug(u'some message')
78
    pr.debug('some message')
79 79
    assert len(ResourceLog.objects.all()) == 0
80 80

  
81 81

  
......
85 85
    assert connector.down() is True
86 86
    ResourceLog.objects.all().delete()
87 87
    pr = ProxyLogger(connector)
88
    pr.debug(u'some message')
88
    pr.debug('some message')
89 89
    assert len(ResourceLog.objects.all()) == 0
90 90

  
91 91

  
......
181 181

  
182 182
@pytest.mark.parametrize('notification_delays', ['0', '0,5,100', '5,100'])
183 183
def test_log_on_connector_availability_change(db, connector, freezer, notification_delays):
184
    connector.title = u'éléphant'
184
    connector.title = 'éléphant'
185 185
    availability_parameters = connector.availability_parameters
186 186
    availability_parameters.notification_delays = notification_delays
187 187
    availability_parameters.save()
......
203 203
    assert last_count1 == 2
204 204
    assert ResourceLog.objects.all()[0].message == 'GET http://example.net/ (=> 404)'
205 205
    assert ResourceLog.objects.all()[1].level == 'error' if notification_delays.startswith('0') else 'warning'
206
    assert u'connector "éléphant" (Feed) is now down: 404 Client' in ResourceLog.objects.all()[1].message
206
    assert 'connector "éléphant" (Feed) is now down: 404 Client' in ResourceLog.objects.all()[1].message
207 207

  
208 208
    # move 5 minutes in the future
209 209
    freezer.move_to(datetime.timedelta(seconds=60 * 5 + 1))
......
219 219
        assert last_count2 == last_count1 + 1
220 220
        assert ResourceLog.objects.all()[2].level == 'error' if notification_delays != '0' else 'warning'
221 221
        assert (
222
            u'connector "éléphant" (Feed) has been down for 5 minutes: 404'
222
            'connector "éléphant" (Feed) has been down for 5 minutes: 404'
223 223
            in ResourceLog.objects.all()[2].message
224 224
        )
225 225

  
......
240 240
    last_count3 = ResourceLog.objects.count()
241 241
    assert last_count3 == last_count2 + 1
242 242
    assert ResourceLog.objects.latest('id').level == 'info'
243
    assert ResourceLog.objects.latest('id').message == u'connector "éléphant" (Feed) is back up'
243
    assert ResourceLog.objects.latest('id').message == 'connector "éléphant" (Feed) is back up'
244 244

  
245 245
    # move 3 minutes in the future
246 246
    freezer.move_to(datetime.timedelta(seconds=60 * 3 + 1))
tests/test_requests.py
466 466
    del extra['request_headers']['User-Agent']
467 467
    assert extra == {
468 468
        'request_headers': {
469
            u'Accept': u'*/*',
470
            u'Accept-Encoding': u'gzip, deflate, br',
471
            u'Connection': u'keep-alive',
469
            'Accept': '*/*',
470
            'Accept-Encoding': 'gzip, deflate, br',
471
            'Connection': 'keep-alive',
472 472
        },
473 473
        'request_url': 'https://example.com/',
474
        'response_headers': {u'Error Webservice': u'\ufffd'},
474
        'response_headers': {'Error Webservice': '\ufffd'},
475 475
        'response_status': 200,
476 476
    }
477 477

  
tests/test_signature.py
33 33
    assert '&nonce=' in signature.sign_url(URL, KEY)
34 34

  
35 35
    # Test unicode key conversion to UTF-8
36
    assert signature.check_url(signature.sign_url(URL, u'\xe9\xe9'), b'\xc3\xa9\xc3\xa9')
37
    assert signature.check_url(signature.sign_url(URL, b'\xc3\xa9\xc3\xa9'), u'\xe9\xe9')
36
    assert signature.check_url(signature.sign_url(URL, '\xe9\xe9'), b'\xc3\xa9\xc3\xa9')
37
    assert signature.check_url(signature.sign_url(URL, b'\xc3\xa9\xc3\xa9'), '\xe9\xe9')
38 38

  
39 39
    # Test timedelta parameter
40 40
    now = datetime.datetime.utcnow()
tests/test_soap.py
68 68

  
69 69
    soap_resource = SOAPResource()
70 70
    client = SOAPClient(soap_resource)
71
    match = "Unexpected element %s, expected %s" % (repr(u'price'), repr(u'skipMe'))
71
    match = "Unexpected element %s, expected %s" % (repr('price'), repr('skipMe'))
72 72
    with pytest.raises(XMLParseError, match=match):
73 73
        client.service.GetLastTradePrice(tickerSymbol='banana')
74 74

  
tests/test_solis.py
145 145
        resp = app.get(endpoint, status=200)
146 146
        assert resp.json['err'] == 0
147 147
        assert resp.json['data'] == 'pong'
148
        assert resp.json['response'] == u'Solis API est opérationnel.'
148
        assert resp.json['response'] == 'Solis API est opérationnel.'
149 149

  
150 150
        assert requests_get.call_args[1]['auth'] == ('usertest', 'userpass')
151 151
        assert requests_get.call_args[1]['verify'] is True
......
498 498
        assert requests_get.call_args[0][0].endswith('/solisapi/referentiels/trans/departement')
499 499
        assert resp.json['err'] == 0
500 500
        assert len(resp.json['data']) == 1
501
        assert resp.json['data'][0]['text'] == u'Ardèche'
501
        assert resp.json['data'][0]['text'] == 'Ardèche'
502 502

  
503 503
        resp = app.get(url + '/trans/departement/?q=arde', status=200)
504 504
        assert resp.json['err'] == 0
505 505
        assert len(resp.json['data']) == 2
506
        assert (resp.json['data'][0]['text'], resp.json['data'][1]['text']) == (u'Ardèche', 'Ardennes')
506
        assert (resp.json['data'][0]['text'], resp.json['data'][1]['text']) == ('Ardèche', 'Ardennes')
507 507

  
508 508
        resp = app.get(url + '/trans/departement/?id=7', status=200)
509 509
        assert requests_get.call_args[0][0].endswith('/solisapi/referentiels/trans/departement')
510 510
        assert resp.json['err'] == 0
511 511
        assert len(resp.json['data']) == 1
512
        assert resp.json['data'][0]['text'] == u'Ardèche'
512
        assert resp.json['data'][0]['text'] == 'Ardèche'
513 513

  
514 514
        resp = app.get(url + '/trans/departement/?id=99', status=200)
515 515
        assert requests_get.call_args[0][0].endswith('/solisapi/referentiels/trans/departement')
......
519 519
        resp = app.get(url + '/trans/departement/?q=arde&ignore=8', status=200)
520 520
        assert resp.json['err'] == 0
521 521
        assert len(resp.json['data']) == 1
522
        assert resp.json['data'][0]['text'] == u'Ardèche'
522
        assert resp.json['data'][0]['text'] == 'Ardèche'
523 523

  
524 524
        resp = app.get(url + '/trans/departement/?q=arde&ignore=8,, 7', status=200)
525 525
        assert resp.json['err'] == 0
tests/test_strasbourg_eu.py
8 8
from passerelle.base.models import AccessRight, ApiUser
9 9
from passerelle.contrib.strasbourg_eu.models import StrasbourgEu
10 10

  
11
INTERESTS_EXAMPLE = u"""{
11
INTERESTS_EXAMPLE = """{
12 12
    "interests": [
13 13
        {
14 14
            "id": "275305",
......
34 34
    ]
35 35
}"""
36 36

  
37
USER_INTERESTS_EXAMPLE = u"""{
37
USER_INTERESTS_EXAMPLE = """{
38 38
    "userId": "M0cG+MtX8/Zr+zSMuI+H7yTC7SeEHT/tvYr1BsdqZic=",
39 39
    "interests": [
40 40
        "275303"
41 41
    ]
42 42
}"""
43 43

  
44
NOTIFICATIONS_EXAMPLE = u"""{
44
NOTIFICATIONS_EXAMPLE = """{
45 45
    "notifications": [
46 46
        {
47 47
            "id": "279201",
......
79 79
    ]
80 80
}"""
81 81

  
82
SUCCESS_EXAMPLE = u"""{
82
SUCCESS_EXAMPLE = """{
83 83
    "success": "MESSAGE"
84 84
}"""
85 85

  
86
ERROR_EXAMPLE = u"""{
86
ERROR_EXAMPLE = """{
87 87
    "error": "MESSAGE"
88 88
}"""
89 89

  
90
UNAUTHORIZED_EXAMPLE = u"""{"error":"not authorized"}"""
90
UNAUTHORIZED_EXAMPLE = """{"error":"not authorized"}"""
91 91

  
92
FAVORITES_EXAMPLE = u"""{
92
FAVORITES_EXAMPLE = """{
93 93
    "favorites": [
94 94
        {
95 95
            "id": "281701",
......
110 110
    ]
111 111
}"""
112 112

  
113
FAVORITE_TYPES_EXAMPLE = u"""{
113
FAVORITE_TYPES_EXAMPLE = """{
114 114
    "types": [
115 115
        {
116 116
            "id": "1",
......
188 188
        resp = app.get(endpoint)
189 189
        assert len(resp.json['data']) == 2
190 190
        assert resp.json['data'][0]['id'] == '275303'
191
        assert resp.json['data'][0]['text'] == u"Type 1 / Centre d'intérêt 1"
191
        assert resp.json['data'][0]['text'] == "Type 1 / Centre d'intérêt 1"
192 192
        assert resp.json['data'][1]['id'] == '275305'
193
        assert resp.json['data'][1]['text'] == u"Type 1 / Centre d'intérêt 2"
193
        assert resp.json['data'][1]['text'] == "Type 1 / Centre d'intérêt 2"
194 194

  
195 195
        resp = app.get(endpoint, params={'name_id': 'xxx'})
196 196
        assert len(resp.json['data']) == 1
197 197
        assert resp.json['data'][0]['id'] == '275303'
198
        assert resp.json['data'][0]['text'] == u"Type 1 / Centre d'intérêt 1"
198
        assert resp.json['data'][0]['text'] == "Type 1 / Centre d'intérêt 1"
199 199

  
200 200
        resp = app.post_json(endpoint, params={})
201 201
        assert resp.json['err_desc'] == 'missing name_id'
tests/test_teamnet_axel.py
290 290
        resp = app.get('/teamnet-axel/test/family/', params=params)
291 291
        assert len(resp.json['data']['adults']) == 1
292 292
        assert len(resp.json['data']['children']) == 1
293
        assert resp.json['data']['family'] == u'8336'
293
        assert resp.json['data']['family'] == '8336'
294 294
        # test filtering
295 295
        resp = app.get('/teamnet-axel/test/family/adults/', params=params)
296 296
        data = resp.json['data']
tests/test_toulouse_axel.py
1393 1393
    jsonschema.validate(update_params, json_schema)
1394 1394
    check_upper(update_params)
1395 1395

  
1396
    assert upperize(u'something with an accent é') == u'SOMETHING WITH AN ACCENT E'
1396
    assert upperize('something with an accent é') == 'SOMETHING WITH AN ACCENT E'
1397 1397

  
1398 1398

  
1399 1399
def test_pre_sanitize_update_family_data_adresse(app, resource, update_params):
tests/wcs/conftest.py
250 250

  
251 251
    with open(wcs_cfg_path, 'w') as fd:
252 252
        fd.write(
253
            u'''[main]
253
            '''[main]
254 254
app_dir = %s\n'''
255 255
            % tmp_app_dir
256 256
        )
......
258 258
    local_settings_path = os.path.join(base_dir, 'local_settings.py')
259 259
    with open(local_settings_path, 'w') as fd:
260 260
        fd.write(
261
            u'''
261
            '''
262 262
WCS_LEGACY_CONFIG_FILE = '{base_dir}/wcs.cfg'
263 263
THEMES_DIRECTORY = '/'
264 264
ALLOWED_HOSTS = ['*']
tests/wcs/test_conftest.py
24 24
    assert wcs_host.url.startswith('http://127.0.0.1:')
25 25
    requests.get(wcs_host.url)
26 26
    response = requests.get(urlparse.urljoin(wcs_host.url, '/api/categories/'))
27
    assert response.json()['data'][0]['title'] == u'Catégorie'
27
    assert response.json()['data'][0]['title'] == 'Catégorie'
28 28

  
29 29

  
30 30
def test_wcs_api(wcs_host):
tests/wcs/test_sp_fr.py
36 36
    settings.KNOWN_SERVICES = {
37 37
        'wcs': {
38 38
            'eservices': {
39
                'title': u'Démarches',
39
                'title': 'Démarches',
40 40
                'url': wcs_host.url,
41 41
                'secret': 'test',
42 42
                'orig': 'test',
......
54 54

  
55 55

  
56 56
def test_resource(spfr):
57
    assert [x[1] for x in get_wcs_choices()] == ['---------', u'D\xe9marches - Demande']
57
    assert [x[1] for x in get_wcs_choices()] == ['---------', 'D\xe9marches - Demande']
58 58

  
59 59

  
60 60
def test_sftp_access(spfr, sftpserver):
61
-