grandlyon streetsections: update for new format of commune names (#71764)
This commit is contained in:
parent
d0bdb9b618
commit
d07523b3c4
|
@ -131,6 +131,7 @@ class GrandLyonStreetSections(BaseResource):
|
|||
)
|
||||
for attribute in ('nom', 'nomcommune', 'domanialite', 'codeinsee'):
|
||||
setattr(section, attribute, value.get(attribute) or '')
|
||||
section.nomcommune = normalize_commune(section.nomcommune)
|
||||
for attribute in ('bornemindroite', 'bornemingauche', 'bornemaxdroite', 'bornemaxgauche', 'gid'):
|
||||
if value.get(attribute) in (None, 'None'):
|
||||
# data.grandlyon returned 'None' as a string at a time
|
||||
|
|
|
@ -209,6 +209,33 @@ DATA_EXAMPLE = """{
|
|||
"senscircspecialise" : null,
|
||||
"senscirculation" : "Double",
|
||||
"typecirculation" : "générale"
|
||||
},
|
||||
{
|
||||
"bornemaxdroite" : 10,
|
||||
"bornemaxgauche" : 11,
|
||||
"bornemindroite" : 2,
|
||||
"bornemingauche" : 1,
|
||||
"codefuv" : "21424",
|
||||
"codeinsee" : "69266",
|
||||
"codetroncon" : "T54753",
|
||||
"datecreation" : "1995-07-17 18:43:00+02:00",
|
||||
"datedomanialite" : null,
|
||||
"datemajalpha" : "2022-11-14",
|
||||
"datemajborne" : "2022-07-26",
|
||||
"datemajgraph" : "2022-07-26",
|
||||
"denomroutiere" : null,
|
||||
"domanialite" : "Métropole",
|
||||
"gestionnaire" : null,
|
||||
"gid" : 30067,
|
||||
"importance" : "Petite rue",
|
||||
"nom" : "Rue de l'Avenir",
|
||||
"nomcommune" : "Villeurbanne",
|
||||
"observation" : null,
|
||||
"particularite" : null,
|
||||
"referencedomanialite" : null,
|
||||
"senscircspecialise" : null,
|
||||
"senscirculation" : "Inverse",
|
||||
"typecirculation" : "Générale"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -238,3 +265,15 @@ def test_daily_none_bornes(app, connector):
|
|||
connector.daily()
|
||||
assert StreetSection.objects.get(codetroncon='T5869').bornemindroite == 0
|
||||
assert StreetSection.objects.get(codetroncon='T5869').bornemaxdroite == 99999
|
||||
|
||||
|
||||
def test_non_uppercase_communes(app, connector):
|
||||
StreetSection.objects.all().delete()
|
||||
with HTTMock(data_mock):
|
||||
connector.daily()
|
||||
response = app.get(
|
||||
"/grandlyon-streetsections/gl-streetsections/section_info"
|
||||
"?streetname=Rue de l'Avenir&commune=Villeurbanne&streetnumber=8"
|
||||
)
|
||||
assert response.json['err'] == 0
|
||||
assert response.json['data']['codetroncon'] == 'T54753'
|
||||
|
|
Loading…
Reference in New Issue