mirror of
https://github.com/getsops/sops.git
synced 2026-02-05 12:45:21 +01:00
* Add vault/api to vendor/ * Adds support for sops publish-ing to Vault * Adds support for publishing secrets (unencrypted) to Vault * Adds a new EmitAsMap for TreeBanches * Adds documentation about sops publish-ing to Vault * Initial integration/functional test for publishing to vault
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
// Licensed under the MIT license, see LICENCE file for details.
|
|
|
|
package quicktest_test
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"testing"
|
|
|
|
qt "github.com/frankban/quicktest"
|
|
)
|
|
|
|
func TestBadCheckf(t *testing.T) {
|
|
err := qt.BadCheckf("bad %s", "wolf")
|
|
expectedMessage := "bad check: bad wolf"
|
|
if err.Error() != expectedMessage {
|
|
t.Fatalf("error:\ngot %q\nwant %q", err, expectedMessage)
|
|
}
|
|
}
|
|
|
|
func TestIsBadCheck(t *testing.T) {
|
|
err := qt.BadCheckf("bad wolf")
|
|
assertBool(t, qt.IsBadCheck(err), true)
|
|
err = errors.New("bad wolf")
|
|
assertBool(t, qt.IsBadCheck(err), false)
|
|
}
|
|
|
|
var errBadWolf = &errTest{
|
|
msg: "bad wolf",
|
|
formatted: true,
|
|
}
|
|
|
|
// errTest is an error type used in tests.
|
|
type errTest struct {
|
|
msg string
|
|
formatted bool
|
|
}
|
|
|
|
// Error implements error.
|
|
func (err *errTest) Error() string {
|
|
return err.msg
|
|
}
|
|
|
|
// Format implements fmt.Formatter.
|
|
func (err *errTest) Format(f fmt.State, c rune) {
|
|
if !f.Flag('+') || c != 'v' {
|
|
fmt.Fprint(f, "unexpected verb for formatting the error")
|
|
}
|
|
fmt.Fprint(f, err.Error())
|
|
if err.formatted {
|
|
fmt.Fprint(f, "\n file:line")
|
|
}
|
|
}
|