Projet

Général

Profil

0001-api_entreprise-fix-normalize_dates-function-39541.patch

Lauréline Guérin, 28 juillet 2020 15:19

Télécharger (1,88 ko)

Voir les différences:

Subject: [PATCH] api_entreprise: fix normalize_dates function (#39541)

 passerelle/apps/api_entreprise/models.py | 3 ++-
 tests/test_api_entreprise.py             | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
passerelle/apps/api_entreprise/models.py
44 44
            normalize_dates(data[key])
45 45
        if isinstance(data[key], list):
46 46
            for item in data[key]:
47
                normalize_dates(item)
47
                if isinstance(item, dict):
48
                    normalize_dates(item)
48 49

  
49 50
        if key.startswith('date') and not key.endswith('timestamp'):
50 51
            if isinstance(data[key], int):
tests/test_api_entreprise.py
192 192
      "type_voie": "RUE",
193 193
      "libelle_voie": "Lebouis",
194 194
      "code_insee": "75120",
195
      "code_postal": "75014",
195
      "code_postal": ["75014"],
196 196
      "commune": "Paris"
197 197
    },
198 198
    "groupement": "Simple",
......
455 455
    assert data['association']['date_publication'] == '1993-03-03'
456 456

  
457 457
    assert 'adresse_siege' in data['association']
458
    assert data['association']['adresse_siege']['code_postal'] == '75014'
458
    assert data['association']['adresse_siege']['code_postal'] == ['75014']
459 459
    assert data['association']['adresse_siege']['code_insee'] == '75120'
460 460

  
461 461

  
462
-