mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Ignore special HTTP fields in response validation tests (#19530)
This commit is contained in:
committed by
GitHub
parent
cc3b0130b6
commit
ce420de231
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user