|
|
|
@ -313,7 +313,7 @@ func TestAuthority_authorizeToken(t *testing.T) {
|
|
|
|
|
p, err := tc.auth.authorizeToken(context.Background(), tc.token)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -399,7 +399,7 @@ func TestAuthority_authorizeRevoke(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
if err := tc.auth.authorizeRevoke(context.Background(), tc.token); err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -484,7 +484,7 @@ func TestAuthority_authorizeSign(t *testing.T) {
|
|
|
|
|
got, err := tc.auth.authorizeSign(context.Background(), tc.token)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -743,7 +743,7 @@ func TestAuthority_Authorize(t *testing.T) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err, fmt.Sprintf("unexpected error: %s", err)) {
|
|
|
|
|
assert.Nil(t, got)
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -879,7 +879,7 @@ func TestAuthority_authorizeRenew(t *testing.T) {
|
|
|
|
|
err := tc.auth.authorizeRenew(tc.cert)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCoder interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -1027,7 +1027,7 @@ func TestAuthority_authorizeSSHSign(t *testing.T) {
|
|
|
|
|
got, err := tc.auth.authorizeSSHSign(context.Background(), tc.token)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -1144,7 +1144,7 @@ func TestAuthority_authorizeSSHRenew(t *testing.T) {
|
|
|
|
|
got, err := tc.auth.authorizeSSHRenew(context.Background(), tc.token)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -1244,7 +1244,7 @@ func TestAuthority_authorizeSSHRevoke(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
if err := tc.auth.authorizeSSHRevoke(context.Background(), tc.token); err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
@ -1337,7 +1337,7 @@ func TestAuthority_authorizeSSHRekey(t *testing.T) {
|
|
|
|
|
cert, signOpts, err := tc.auth.authorizeSSHRekey(context.Background(), tc.token)
|
|
|
|
|
if err != nil {
|
|
|
|
|
if assert.NotNil(t, tc.err) {
|
|
|
|
|
sc, ok := render.AsStatusCodedError(err)
|
|
|
|
|
sc, ok := err.(render.StatusCodedError)
|
|
|
|
|
assert.Fatal(t, ok, "error does not implement StatusCodedError interface")
|
|
|
|
|
assert.Equals(t, sc.StatusCode(), tc.code)
|
|
|
|
|
assert.HasPrefix(t, err.Error(), tc.err.Error())
|
|
|
|
|