mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 20:17:59 +00:00
credential/app-id
This commit is contained in:
@@ -55,6 +55,9 @@ type TestStep struct {
|
||||
// step will be called
|
||||
Check TestCheckFunc
|
||||
|
||||
// ErrorOk, if true, will let erroneous responses through to the check
|
||||
ErrorOk bool
|
||||
|
||||
// Unauthenticated, if true, will make the request unauthenticated.
|
||||
Unauthenticated bool
|
||||
}
|
||||
@@ -172,7 +175,7 @@ func Test(t TestT, c TestCase) {
|
||||
resp.Data,
|
||||
))
|
||||
}
|
||||
if err == nil && resp.IsError() {
|
||||
if err == nil && resp.IsError() && !s.ErrorOk {
|
||||
err = fmt.Errorf("Erroneous response:\n\n%#v", resp)
|
||||
}
|
||||
if err == nil && s.Check != nil {
|
||||
@@ -246,6 +249,17 @@ func TestCheckAuth(policies []string) TestCheckFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// TestCheckError is a helper to check that a response is an error.
|
||||
func TestCheckError() TestCheckFunc {
|
||||
return func(resp *logical.Response) error {
|
||||
if !resp.IsError() {
|
||||
return fmt.Errorf("response should be error")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// TestT is the interface used to handle the test lifecycle of a test.
|
||||
//
|
||||
// Users should just use a *testing.T object, which implements this.
|
||||
|
||||
Reference in New Issue
Block a user