Projet

Général

Profil

0001-tcl-adapt-to-updated-attributes-in-line-data-sources.patch

Frédéric Péters, 21 novembre 2022 15:51

Télécharger (1,99 ko)

Voir les différences:

Subject: [PATCH] tcl: adapt to updated attributes in line data sources
 (#71509)

 passerelle/contrib/tcl/models.py | 4 ++++
 tests/test_tcl.py                | 8 ++------
 2 files changed, 6 insertions(+), 6 deletions(-)
passerelle/contrib/tcl/models.py
131 131
                response = self.requests.get(url)
132 132
                response.raise_for_status()
133 133
                for line_data in response.json()['values']:
134
                    if 'code_trace' in line_data:
135
                        line_data['code_titan'] = line_data['code_trace']
136
                    if 'nom_trace' in line_data:
137
                        line_data['libelle'] = line_data['nom_trace']
134 138
                    line, dummy = Line.objects.get_or_create(
135 139
                        code_titan=line_data['code_titan'],
136 140
                        defaults={'transport_key': key, 'ligne': line_data['ligne']},
tests/test_tcl.py
10 10
LIGNE_BUS = {
11 11
    "values": [
12 12
        {
13
            "indice": "",
14 13
            "last_update_fme": "2017-06-27 06:01:10",
15
            "infos": "",
16
            "couleur": "164 203 38",
17
            "libelle": "Croix Rousse - Plateaux de St Rambert",
14
            "nom_trace": "Croix Rousse - Plateaux de St Rambert",
18 15
            "last_update": "None",
19
            "code_titan": "2Aa1",
16
            "code_trace": "2Aa1",
20 17
            "gid": "1003",
21 18
            "ligne": "2",
22
            "ut": "UTV",
23 19
            "sens": "Aller",
24 20
        },
25 21
    ]
26
-