credential/app-id

This commit is contained in:
Mitchell Hashimoto
2015-04-04 18:40:21 -07:00
parent 2b12d51d70
commit 61b7b71dec
6 changed files with 260 additions and 3 deletions

View File

@@ -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.