Addapt tests to the api change.

This commit is contained in:
Mariano Cano 2019-12-11 18:18:13 -08:00 committed by max furman
parent c6f6493bb7
commit dedf6b17be
2 changed files with 5 additions and 4 deletions

View file

@ -565,7 +565,7 @@ type mockAuthority struct {
getSSHRoots func() (*authority.SSHKeys, error)
getSSHFederation func() (*authority.SSHKeys, error)
getSSHConfig func(typ string, data map[string]string) ([]templates.Output, error)
checkSSHHost func(principal string) (bool, error)
checkSSHHost func(ctx context.Context, principal, token string) (bool, error)
getSSHBastion func(user string, hostname string) (*authority.Bastion, error)
version func() authority.Version
}
@ -715,9 +715,9 @@ func (m *mockAuthority) GetSSHConfig(typ string, data map[string]string) ([]temp
return m.ret1.([]templates.Output), m.err
}
func (m *mockAuthority) CheckSSHHost(principal string) (bool, error) {
func (m *mockAuthority) CheckSSHHost(ctx context.Context, principal, token string) (bool, error) {
if m.checkSSHHost != nil {
return m.checkSSHHost(principal)
return m.checkSSHHost(ctx, principal, token)
}
return m.ret1.(bool), m.err
}

View file

@ -2,6 +2,7 @@ package api
import (
"bytes"
"context"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
@ -539,7 +540,7 @@ func Test_caHandler_SSHCheckHost(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
h := New(&mockAuthority{
checkSSHHost: func(_ string) (bool, error) {
checkSSHHost: func(ctx context.Context, principal, token string) (bool, error) {
return tt.exists, tt.err
},
}).(*caHandler)