Projet

Général

Profil

0001-mdph13-only-validate-valued-date-fields.patch

Benjamin Dauvergne, 12 mars 2019 11:19

Télécharger (1,65 ko)

Voir les différences:

Subject: [PATCH] mdph13: only validate valued date fields

 passerelle/contrib/mdph13/models.py | 4 ++--
 tests/test_mdph13.py                | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
passerelle/contrib/mdph13/models.py
157 157

  
158 158
        def check(value, path):
159 159
            if path[-1].startswith('date_'):
160
                if (not isinstance(value, six.text_type)
161
                        or not self.DATE_RE.match(value)):
160
                if (isinstance(value, six.text_type)
161
                        and not self.DATE_RE.match(value)):
162 162
                    errors.append('%s is not a date string' % '.'.join(path))
163 163
        json_walker(data, check)
164 164
        if errors:
tests/test_mdph13.py
93 93
                "prestation": "Carte d'invalidité (de priorité) pour personne handicapée",
94 94
                "statut": "Instruction administrative terminée en attente de passage en évaluation",
95 95
                "typologie": "Demande En Cours",
96
                "date_decision": "2015-01-16"
96
                "date_decision": None,
97 97
            },
98 98
            {
99 99
                "numero": "1210524",
100
-