1
1
package authority
2
2
3
3
import (
4
+ "context"
4
5
"crypto/ecdsa"
5
6
"crypto/elliptic"
6
7
"crypto/rand"
@@ -476,7 +477,9 @@ func TestAuthority_CheckSSHHost(t *testing.T) {
476
477
err error
477
478
}
478
479
type args struct {
480
+ ctx context.Context
479
481
principal string
482
+ token string
480
483
}
481
484
tests := []struct {
482
485
name string
@@ -485,12 +488,12 @@ func TestAuthority_CheckSSHHost(t *testing.T) {
485
488
want bool
486
489
wantErr bool
487
490
}{
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 },
494
497
}
495
498
for _ , tt := range tests {
496
499
t .Run (tt .name , func (t * testing.T ) {
@@ -500,7 +503,7 @@ func TestAuthority_CheckSSHHost(t *testing.T) {
500
503
return tt .fields .exists , tt .fields .err
501
504
},
502
505
}
503
- got , err := a .CheckSSHHost (tt .args .principal )
506
+ got , err := a .CheckSSHHost (tt .args .ctx , tt . args . principal , tt . args . token )
504
507
if (err != nil ) != tt .wantErr {
505
508
t .Errorf ("Authority.CheckSSHHost() error = %v, wantErr %v" , err , tt .wantErr )
506
509
return
0 commit comments