From 9b889430d1fa6b68e66d6ba59d42ba0686fc6fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 21 Nov 2022 13:45:57 +0100 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(-) diff --git a/passerelle/contrib/tcl/models.py b/passerelle/contrib/tcl/models.py index 4ac739aa..5ae31ea7 100644 --- a/passerelle/contrib/tcl/models.py +++ b/passerelle/contrib/tcl/models.py @@ -131,6 +131,10 @@ class Tcl(BaseResource): response = self.requests.get(url) response.raise_for_status() for line_data in response.json()['values']: + if 'code_trace' in line_data: + line_data['code_titan'] = line_data['code_trace'] + if 'nom_trace' in line_data: + line_data['libelle'] = line_data['nom_trace'] line, dummy = Line.objects.get_or_create( code_titan=line_data['code_titan'], defaults={'transport_key': key, 'ligne': line_data['ligne']}, diff --git a/tests/test_tcl.py b/tests/test_tcl.py index f59507ba..13c1472a 100644 --- a/tests/test_tcl.py +++ b/tests/test_tcl.py @@ -10,16 +10,12 @@ from passerelle.contrib.tcl.models import Line, Stop, Tcl LIGNE_BUS = { "values": [ { - "indice": "", "last_update_fme": "2017-06-27 06:01:10", - "infos": "", - "couleur": "164 203 38", - "libelle": "Croix Rousse - Plateaux de St Rambert", + "nom_trace": "Croix Rousse - Plateaux de St Rambert", "last_update": "None", - "code_titan": "2Aa1", + "code_trace": "2Aa1", "gid": "1003", "ligne": "2", - "ut": "UTV", "sens": "Aller", }, ]