Ignore special HTTP fields in response validation tests (#19530)

This commit is contained in:
Anton Averchenkov
2023-03-14 13:21:20 -04:00
committed by GitHub
parent cc3b0130b6
commit ce420de231
3 changed files with 73 additions and 13 deletions

View File

@@ -249,6 +249,60 @@ func TestValidateResponse(t *testing.T) {
strict: false,
errorExpected: false,
},
"empty schema, response has http_raw_body, strict": {
schema: &framework.Response{
Fields: map[string]*framework.FieldSchema{},
},
response: map[string]interface{}{
"http_raw_body": "foo",
},
strict: true,
errorExpected: false,
},
"empty schema, response has http_raw_body, not strict": {
schema: &framework.Response{
Fields: map[string]*framework.FieldSchema{},
},
response: map[string]interface{}{
"http_raw_body": "foo",
},
strict: false,
errorExpected: false,
},
"schema has http_raw_body, strict": {
schema: &framework.Response{
Fields: map[string]*framework.FieldSchema{
"http_raw_body": {
Type: framework.TypeString,
Required: false,
},
},
},
response: map[string]interface{}{
"http_raw_body": "foo",
},
strict: true,
errorExpected: true,
},
"schema has http_raw_body, not strict": {
schema: &framework.Response{
Fields: map[string]*framework.FieldSchema{
"http_raw_body": {
Type: framework.TypeString,
Required: false,
},
},
},
response: map[string]interface{}{
"http_raw_body": "foo",
},
strict: false,
errorExpected: true,
},
}
for name, tc := range cases {