Closed jpmckinney closed 4 years ago
_______________________________________________________________________________________________________ test_validation_errors _______________________________________________________________________________________________________ def test_validation_errors(): """ Check that the validation errors are the ones we are expecting """ errors, ctx = utils.test_fixture("validation-errors-package.json") invalid_code = [] invalid_uri = [] invalid_number = [] invalid_date = [] invalid_string = [] invalid_array = [] invalid_object = [] invalid_int = [] missing_value = [] invalid_length = [] for err in errors: if "Invalid code found in" in err: invalid_code.append(err) elif "Invalid 'uri' found" in err: invalid_uri.append(err) elif "Date is not in the correct format" in err: invalid_date.append(err) elif "is not a string" in err: invalid_string.append(err) elif "is not a integer" in err: invalid_int.append(err) elif "is not a JSON object" in err: invalid_object.append(err) elif "is not a JSON array" in err: invalid_array.append(err) elif "is not a number" in err: invalid_number.append(err) elif "is too short" in err: invalid_length.append(err) elif "is missing but required" in err: missing_value.append(err) else: # We shouldn't reach here if we have sorted all the validation # errors assert False, "Validation error '%s' not captured" % err assert len(invalid_code) == 5, "Expecting 5 invalid codes" assert len(invalid_uri) == 2, "Expecting 2 invalid uris" assert len(invalid_date) == 1, "Expecting 1 invalid dates" assert len(invalid_string) == 18, "Expecting 18 invalid strings" assert len(invalid_int) == 1, "Expecting 1 invalid intergers" assert len(invalid_object) == 3, "Expecting 3 invalid objects" assert len(invalid_array) == 8, "Expecting 8 invalid arrays" assert len(invalid_number) == 4, "Expecting 4 invalid numbers" assert len(invalid_length) == 1, "Expecting 1 invalid value length" > assert len(missing_value) == 14, "Expecting 14 missing values" E AssertionError: Expecting 14 missing values E assert 8 == 14 E + where 8 = len(['{"message": "\'date\' is missing but required within \'releases\'", "message_safe": "<code>date</code> is missing bu...o_number": "projects", "header": "id", "header_extra": "projects/[number]", "null_clause": "", "error_id": null}', ...])
Fixed during #18