def test_dates_validator_warns_when_date_is_invalid(warning): json_dict = { 'control_number': 123, 'opening_date': 'bar', } dates_validator(None, json_dict) warning.assert_called_once_with('MALFORMED: %s value in %s: %s', 'opening_date', 123, 'bar')
def test_dates_validator_warns_when_date_is_invalid(warning): json_dict = { 'control_number': 'foo', 'opening_date': 'bar', } dates_validator(None, json_dict) warning.assert_called_once_with( 'MALFORMED: %s value in %s: %s', 'opening_date', 'foo', 'bar')
def test_dates_validator_does_nothing_when_dates_are_valid(): json_dict = { 'opening_date': '1993-02-02', 'closing_date': '1993-02-02', 'deadline_date': '1993-02-02', } dates_validator(None, json_dict) assert json_dict['opening_date'] == '1993-02-02' assert json_dict['closing_date'] == '1993-02-02' assert json_dict['deadline_date'] == '1993-02-02'