فهرست منبع

Addapt tests to the api change.

Mariano Cano 7 سال پیش
والد
کامیت
dedf6b17be
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 3 3
      api/api_test.go
  2. 2 1
      api/ssh_test.go

+ 3 - 3
api/api_test.go

@@ -565,7 +565,7 @@ type mockAuthority struct {
 	getSSHRoots                  func() (*authority.SSHKeys, error)
 	getSSHRoots                  func() (*authority.SSHKeys, error)
 	getSSHFederation             func() (*authority.SSHKeys, error)
 	getSSHFederation             func() (*authority.SSHKeys, error)
 	getSSHConfig                 func(typ string, data map[string]string) ([]templates.Output, 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)
 	getSSHBastion                func(user string, hostname string) (*authority.Bastion, error)
 	version                      func() authority.Version
 	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
 	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 {
 	if m.checkSSHHost != nil {
-		return m.checkSSHHost(principal)
+		return m.checkSSHHost(ctx, principal, token)
 	}
 	}
 	return m.ret1.(bool), m.err
 	return m.ret1.(bool), m.err
 }
 }

+ 2 - 1
api/ssh_test.go

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