I need a test case that verifies that a '400 Bad Request' is returned when an API call is made without the required field. (Previously there was a bug where the field was needed, but requests without were being accepted)
It's a simple POST call with auth and a raw body. It returns a 200 when the missing field is returned.
The POST returns the '400 Bad Request' correctly, but I can't get the test to pass.
The following tests all fail:
pm.test("Status is an error", function () {
pm.response.to.be.error;
});
pm.test("Status code is 400", function () {
pm.response.to.have.status(400);
});
The response body is:
Instantiation of [simple type, class com.[company].[product].notifications.api.v2.models.NotificationCreateV2] value failed for JSON property content due to missing (therefore NULL) value for creator parameter content which is a non-nullable type
at [Source: (byte[])"{
"field1": "string",
"field2": "Snort",
"field3": "Signature 5102",
"field4": "2019-04-19T10:34:03Z",
"field5": 0,
"field6": 4
}"; line: 8, column: 1] (through reference chain: com.[company].[product].notifications.api.v2.models.NotificationCreateV2["content"])