Add tests for ssh api methods.

This commit is contained in:
Mariano Cano 2019-10-14 13:07:28 -07:00 committed by max furman
parent 38d735be6e
commit f5023244fe
3 changed files with 240 additions and 5 deletions

View file

@ -516,6 +516,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)
}
// TODO: remove once Authorize is deprecated.
@ -642,6 +643,13 @@ 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) {
if m.checkSSHHost != nil {
return m.checkSSHHost(principal)
}
return m.ret1.(bool), m.err
}
func Test_caHandler_Route(t *testing.T) {
type fields struct {
Authority Authority