Skip to content

Commit f4615d6

Browse files
marainodopey
authored andcommitted
Addapt test to api change.
1 parent dedf6b1 commit f4615d6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

authority/ssh_test.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package authority
22

33
import (
4+
"context"
45
"crypto/ecdsa"
56
"crypto/elliptic"
67
"crypto/rand"
@@ -476,7 +477,9 @@ func TestAuthority_CheckSSHHost(t *testing.T) {
476477
err error
477478
}
478479
type args struct {
480+
ctx context.Context
479481
principal string
482+
token string
480483
}
481484
tests := []struct {
482485
name string
@@ -485,12 +488,12 @@ func TestAuthority_CheckSSHHost(t *testing.T) {
485488
want bool
486489
wantErr bool
487490
}{
488-
{"true", fields{true, nil}, args{"foo.internal.com"}, true, false},
489-
{"false", fields{false, nil}, args{"foo.internal.com"}, false, false},
490-
{"notImplemented", fields{false, db.ErrNotImplemented}, args{"foo.internal.com"}, false, true},
491-
{"notImplemented", fields{true, db.ErrNotImplemented}, args{"foo.internal.com"}, false, true},
492-
{"internal", fields{false, fmt.Errorf("an error")}, args{"foo.internal.com"}, false, true},
493-
{"internal", fields{true, fmt.Errorf("an error")}, args{"foo.internal.com"}, false, true},
491+
{"true", fields{true, nil}, args{context.TODO(), "foo.internal.com", ""}, true, false},
492+
{"false", fields{false, nil}, args{context.TODO(), "foo.internal.com", ""}, false, false},
493+
{"notImplemented", fields{false, db.ErrNotImplemented}, args{context.TODO(), "foo.internal.com", ""}, false, true},
494+
{"notImplemented", fields{true, db.ErrNotImplemented}, args{context.TODO(), "foo.internal.com", ""}, false, true},
495+
{"internal", fields{false, fmt.Errorf("an error")}, args{context.TODO(), "foo.internal.com", ""}, false, true},
496+
{"internal", fields{true, fmt.Errorf("an error")}, args{context.TODO(), "foo.internal.com", ""}, false, true},
494497
}
495498
for _, tt := range tests {
496499
t.Run(tt.name, func(t *testing.T) {
@@ -500,7 +503,7 @@ func TestAuthority_CheckSSHHost(t *testing.T) {
500503
return tt.fields.exists, tt.fields.err
501504
},
502505
}
503-
got, err := a.CheckSSHHost(tt.args.principal)
506+
got, err := a.CheckSSHHost(tt.args.ctx, tt.args.principal, tt.args.token)
504507
if (err != nil) != tt.wantErr {
505508
t.Errorf("Authority.CheckSSHHost() error = %v, wantErr %v", err, tt.wantErr)
506509
return

0 commit comments

Comments
 (0)