4
0

controller_test.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. package provisioner
  2. import (
  3. "context"
  4. "crypto/x509"
  5. "fmt"
  6. "net/http"
  7. "reflect"
  8. "testing"
  9. "time"
  10. "github.com/smallstep/certificates/authority/policy"
  11. "github.com/smallstep/certificates/internal/httptransport"
  12. "github.com/smallstep/certificates/webhook"
  13. "github.com/smallstep/linkedca"
  14. "github.com/stretchr/testify/assert"
  15. "go.step.sm/crypto/pemutil"
  16. "go.step.sm/crypto/x509util"
  17. "golang.org/x/crypto/ssh"
  18. )
  19. var trueValue = true
  20. func mustClaimer(t *testing.T, claims *Claims, global Claims) *Claimer {
  21. t.Helper()
  22. c, err := NewClaimer(claims, global)
  23. if err != nil {
  24. t.Fatal(err)
  25. }
  26. return c
  27. }
  28. func mustDuration(t *testing.T, s string) *Duration {
  29. t.Helper()
  30. d, err := NewDuration(s)
  31. if err != nil {
  32. t.Fatal(err)
  33. }
  34. return d
  35. }
  36. func mustNewPolicyEngine(t *testing.T, options *Options) *policyEngine {
  37. t.Helper()
  38. c, err := newPolicyEngine(options)
  39. if err != nil {
  40. t.Fatal(err)
  41. }
  42. return c
  43. }
  44. func TestNewController(t *testing.T) {
  45. options := &Options{
  46. X509: &X509Options{
  47. AllowedNames: &policy.X509NameOptions{
  48. DNSDomains: []string{"*.local"},
  49. },
  50. },
  51. SSH: &SSHOptions{
  52. Host: &policy.SSHHostCertificateOptions{
  53. AllowedNames: &policy.SSHNameOptions{
  54. DNSDomains: []string{"*.local"},
  55. },
  56. },
  57. User: &policy.SSHUserCertificateOptions{
  58. AllowedNames: &policy.SSHNameOptions{
  59. EmailAddresses: []string{"@example.com"},
  60. },
  61. },
  62. },
  63. }
  64. type args struct {
  65. p Interface
  66. claims *Claims
  67. config Config
  68. options *Options
  69. }
  70. tests := []struct {
  71. name string
  72. args args
  73. want *Controller
  74. wantErr bool
  75. }{
  76. {"ok", args{&JWK{}, nil, Config{
  77. Claims: globalProvisionerClaims,
  78. Audiences: testAudiences,
  79. HTTPClient: &http.Client{},
  80. WrapTransport: httptransport.NoopWrapper(),
  81. }, nil}, &Controller{
  82. Interface: &JWK{},
  83. Audiences: &testAudiences,
  84. Claimer: mustClaimer(t, nil, globalProvisionerClaims),
  85. httpClient: &http.Client{},
  86. wrapTransport: httptransport.NoopWrapper(),
  87. }, false},
  88. {"ok with claims", args{&JWK{}, &Claims{
  89. DisableRenewal: &defaultDisableRenewal,
  90. }, Config{
  91. Claims: globalProvisionerClaims,
  92. Audiences: testAudiences,
  93. }, nil}, &Controller{
  94. Interface: &JWK{},
  95. Audiences: &testAudiences,
  96. Claimer: mustClaimer(t, &Claims{
  97. DisableRenewal: &defaultDisableRenewal,
  98. }, globalProvisionerClaims),
  99. wrapTransport: httptransport.NoopWrapper(),
  100. }, false},
  101. {"ok with claims and options", args{&JWK{}, &Claims{
  102. DisableRenewal: &defaultDisableRenewal,
  103. }, Config{
  104. Claims: globalProvisionerClaims,
  105. Audiences: testAudiences,
  106. }, options}, &Controller{
  107. Interface: &JWK{},
  108. Audiences: &testAudiences,
  109. Claimer: mustClaimer(t, &Claims{
  110. DisableRenewal: &defaultDisableRenewal,
  111. }, globalProvisionerClaims),
  112. policy: mustNewPolicyEngine(t, options),
  113. wrapTransport: httptransport.NoopWrapper(),
  114. }, false},
  115. {"fail claimer", args{&JWK{}, &Claims{
  116. MinTLSDur: mustDuration(t, "24h"),
  117. MaxTLSDur: mustDuration(t, "2h"),
  118. }, Config{
  119. Claims: globalProvisionerClaims,
  120. Audiences: testAudiences,
  121. }, nil}, nil, true},
  122. {"fail options", args{&JWK{}, &Claims{
  123. DisableRenewal: &defaultDisableRenewal,
  124. }, Config{
  125. Claims: globalProvisionerClaims,
  126. Audiences: testAudiences,
  127. }, &Options{
  128. X509: &X509Options{
  129. AllowedNames: &policy.X509NameOptions{
  130. DNSDomains: []string{"**.local"},
  131. },
  132. },
  133. }}, nil, true},
  134. }
  135. for _, tt := range tests {
  136. t.Run(tt.name, func(t *testing.T) {
  137. got, err := NewController(tt.args.p, tt.args.claims, tt.args.config, tt.args.options)
  138. if (err != nil) != tt.wantErr {
  139. t.Errorf("NewController() error = %v, wantErr %v", err, tt.wantErr)
  140. return
  141. }
  142. // A function can only be compared to nil
  143. if tt.want != nil && got != nil {
  144. assert.NotNil(t, got.wrapTransport)
  145. tt.want.wrapTransport = nil
  146. got.wrapTransport = nil
  147. }
  148. if !reflect.DeepEqual(got, tt.want) {
  149. t.Errorf("NewController() = %v, want %v", got, tt.want)
  150. }
  151. })
  152. }
  153. }
  154. func TestController_GetHTTPClient(t *testing.T) {
  155. srv := generateTLSJWKServer(2)
  156. defer srv.Close()
  157. type fields struct {
  158. httpClient *http.Client
  159. }
  160. tests := []struct {
  161. name string
  162. fields fields
  163. want *http.Client
  164. }{
  165. {"ok custom", fields{srv.Client()}, srv.Client()},
  166. {"ok default", fields{http.DefaultClient}, http.DefaultClient},
  167. }
  168. for _, tt := range tests {
  169. t.Run(tt.name, func(t *testing.T) {
  170. c := &Controller{
  171. httpClient: tt.fields.httpClient,
  172. }
  173. assert.Equal(t, tt.want, c.GetHTTPClient())
  174. })
  175. }
  176. }
  177. func TestController_GetIdentity(t *testing.T) {
  178. ctx := context.Background()
  179. type fields struct {
  180. Interface Interface
  181. IdentityFunc GetIdentityFunc
  182. }
  183. type args struct {
  184. ctx context.Context
  185. email string
  186. }
  187. tests := []struct {
  188. name string
  189. fields fields
  190. args args
  191. want *Identity
  192. wantErr bool
  193. }{
  194. {"ok", fields{&OIDC{}, nil}, args{ctx, "jane@doe.org"}, &Identity{
  195. Usernames: []string{"jane", "jane@doe.org"},
  196. }, false},
  197. {"ok custom", fields{&OIDC{}, func(ctx context.Context, p Interface, email string) (*Identity, error) {
  198. return &Identity{Usernames: []string{"jane"}}, nil
  199. }}, args{ctx, "jane@doe.org"}, &Identity{
  200. Usernames: []string{"jane"},
  201. }, false},
  202. {"ok badname", fields{&OIDC{}, nil}, args{ctx, "1000@doe.org"}, &Identity{
  203. Usernames: []string{"1000", "1000@doe.org"},
  204. }, false},
  205. {"ok sanitized badname", fields{&OIDC{}, nil}, args{ctx, "1000+10@doe.org"}, &Identity{
  206. Usernames: []string{"1000_10", "1000+10", "1000+10@doe.org"},
  207. }, false},
  208. {"fail provisioner", fields{&JWK{}, nil}, args{ctx, "jane@doe.org"}, nil, true},
  209. {"fail custom", fields{&OIDC{}, func(ctx context.Context, p Interface, email string) (*Identity, error) {
  210. return nil, fmt.Errorf("an error")
  211. }}, args{ctx, "jane@doe.org"}, nil, true},
  212. }
  213. for _, tt := range tests {
  214. t.Run(tt.name, func(t *testing.T) {
  215. c := &Controller{
  216. Interface: tt.fields.Interface,
  217. IdentityFunc: tt.fields.IdentityFunc,
  218. }
  219. got, err := c.GetIdentity(tt.args.ctx, tt.args.email)
  220. if (err != nil) != tt.wantErr {
  221. t.Errorf("Controller.GetIdentity() error = %v, wantErr %v", err, tt.wantErr)
  222. return
  223. }
  224. if !reflect.DeepEqual(got, tt.want) {
  225. t.Errorf("Controller.GetIdentity() = %v, want %v", got, tt.want)
  226. }
  227. })
  228. }
  229. }
  230. func TestController_AuthorizeRenew(t *testing.T) {
  231. ctx := context.Background()
  232. now := time.Now().Truncate(time.Second)
  233. type fields struct {
  234. Interface Interface
  235. Claimer *Claimer
  236. AuthorizeRenewFunc AuthorizeRenewFunc
  237. }
  238. type args struct {
  239. ctx context.Context
  240. cert *x509.Certificate
  241. }
  242. tests := []struct {
  243. name string
  244. fields fields
  245. args args
  246. wantErr bool
  247. }{
  248. {"ok", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), nil}, args{ctx, &x509.Certificate{
  249. NotBefore: now,
  250. NotAfter: now.Add(time.Hour),
  251. }}, false},
  252. {"ok custom", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), func(ctx context.Context, p *Controller, cert *x509.Certificate) error {
  253. return nil
  254. }}, args{ctx, &x509.Certificate{
  255. NotBefore: now,
  256. NotAfter: now.Add(time.Hour),
  257. }}, false},
  258. {"ok custom disabled", fields{&JWK{}, mustClaimer(t, &Claims{AllowRenewalAfterExpiry: &trueValue}, globalProvisionerClaims), func(ctx context.Context, p *Controller, cert *x509.Certificate) error {
  259. return nil
  260. }}, args{ctx, &x509.Certificate{
  261. NotBefore: now,
  262. NotAfter: now.Add(time.Hour),
  263. }}, false},
  264. {"ok renew after expiry", fields{&JWK{}, mustClaimer(t, &Claims{AllowRenewalAfterExpiry: &trueValue}, globalProvisionerClaims), nil}, args{ctx, &x509.Certificate{
  265. NotBefore: now.Add(-time.Hour),
  266. NotAfter: now.Add(-time.Minute),
  267. }}, false},
  268. {"fail disabled", fields{&JWK{}, mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims), nil}, args{ctx, &x509.Certificate{
  269. NotBefore: now,
  270. NotAfter: now.Add(time.Hour),
  271. }}, true},
  272. {"fail not yet valid", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), nil}, args{ctx, &x509.Certificate{
  273. NotBefore: now.Add(time.Hour),
  274. NotAfter: now.Add(2 * time.Hour),
  275. }}, true},
  276. {"fail expired", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), nil}, args{ctx, &x509.Certificate{
  277. NotBefore: now.Add(-time.Hour),
  278. NotAfter: now.Add(-time.Minute),
  279. }}, true},
  280. {"fail custom", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), func(ctx context.Context, p *Controller, cert *x509.Certificate) error {
  281. return fmt.Errorf("an error")
  282. }}, args{ctx, &x509.Certificate{
  283. NotBefore: now,
  284. NotAfter: now.Add(time.Hour),
  285. }}, true},
  286. }
  287. for _, tt := range tests {
  288. t.Run(tt.name, func(t *testing.T) {
  289. c := &Controller{
  290. Interface: tt.fields.Interface,
  291. Claimer: tt.fields.Claimer,
  292. AuthorizeRenewFunc: tt.fields.AuthorizeRenewFunc,
  293. }
  294. if err := c.AuthorizeRenew(tt.args.ctx, tt.args.cert); (err != nil) != tt.wantErr {
  295. t.Errorf("Controller.AuthorizeRenew() error = %v, wantErr %v", err, tt.wantErr)
  296. }
  297. })
  298. }
  299. }
  300. func TestController_AuthorizeSSHRenew(t *testing.T) {
  301. ctx := context.Background()
  302. now := time.Now()
  303. type fields struct {
  304. Interface Interface
  305. Claimer *Claimer
  306. AuthorizeSSHRenewFunc AuthorizeSSHRenewFunc
  307. }
  308. type args struct {
  309. ctx context.Context
  310. cert *ssh.Certificate
  311. }
  312. tests := []struct {
  313. name string
  314. fields fields
  315. args args
  316. wantErr bool
  317. }{
  318. {"ok", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), nil}, args{ctx, &ssh.Certificate{
  319. ValidAfter: uint64(now.Unix()),
  320. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  321. }}, false},
  322. {"ok custom", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), func(ctx context.Context, p *Controller, cert *ssh.Certificate) error {
  323. return nil
  324. }}, args{ctx, &ssh.Certificate{
  325. ValidAfter: uint64(now.Unix()),
  326. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  327. }}, false},
  328. {"ok custom disabled", fields{&JWK{}, mustClaimer(t, &Claims{AllowRenewalAfterExpiry: &trueValue}, globalProvisionerClaims), func(ctx context.Context, p *Controller, cert *ssh.Certificate) error {
  329. return nil
  330. }}, args{ctx, &ssh.Certificate{
  331. ValidAfter: uint64(now.Unix()),
  332. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  333. }}, false},
  334. {"ok renew after expiry", fields{&JWK{}, mustClaimer(t, &Claims{AllowRenewalAfterExpiry: &trueValue}, globalProvisionerClaims), nil}, args{ctx, &ssh.Certificate{
  335. ValidAfter: uint64(now.Add(-time.Hour).Unix()),
  336. ValidBefore: uint64(now.Add(-time.Minute).Unix()),
  337. }}, false},
  338. {"fail disabled", fields{&JWK{}, mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims), nil}, args{ctx, &ssh.Certificate{
  339. ValidAfter: uint64(now.Unix()),
  340. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  341. }}, true},
  342. {"fail not yet valid", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), nil}, args{ctx, &ssh.Certificate{
  343. ValidAfter: uint64(now.Add(time.Hour).Unix()),
  344. ValidBefore: uint64(now.Add(2 * time.Hour).Unix()),
  345. }}, true},
  346. {"fail expired", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), nil}, args{ctx, &ssh.Certificate{
  347. ValidAfter: uint64(now.Add(-time.Hour).Unix()),
  348. ValidBefore: uint64(now.Add(-time.Minute).Unix()),
  349. }}, true},
  350. {"fail custom", fields{&JWK{}, mustClaimer(t, nil, globalProvisionerClaims), func(ctx context.Context, p *Controller, cert *ssh.Certificate) error {
  351. return fmt.Errorf("an error")
  352. }}, args{ctx, &ssh.Certificate{
  353. ValidAfter: uint64(now.Unix()),
  354. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  355. }}, true},
  356. }
  357. for _, tt := range tests {
  358. t.Run(tt.name, func(t *testing.T) {
  359. c := &Controller{
  360. Interface: tt.fields.Interface,
  361. Claimer: tt.fields.Claimer,
  362. AuthorizeSSHRenewFunc: tt.fields.AuthorizeSSHRenewFunc,
  363. }
  364. if err := c.AuthorizeSSHRenew(tt.args.ctx, tt.args.cert); (err != nil) != tt.wantErr {
  365. t.Errorf("Controller.AuthorizeSSHRenew() error = %v, wantErr %v", err, tt.wantErr)
  366. }
  367. })
  368. }
  369. }
  370. func TestDefaultAuthorizeRenew(t *testing.T) {
  371. ctx := context.Background()
  372. now := time.Now().Truncate(time.Second)
  373. type args struct {
  374. ctx context.Context
  375. p *Controller
  376. cert *x509.Certificate
  377. }
  378. tests := []struct {
  379. name string
  380. args args
  381. wantErr bool
  382. }{
  383. {"ok", args{ctx, &Controller{
  384. Interface: &JWK{},
  385. Claimer: mustClaimer(t, nil, globalProvisionerClaims),
  386. }, &x509.Certificate{
  387. NotBefore: now,
  388. NotAfter: now.Add(time.Hour),
  389. }}, false},
  390. {"ok renew after expiry", args{ctx, &Controller{
  391. Interface: &JWK{},
  392. Claimer: mustClaimer(t, &Claims{AllowRenewalAfterExpiry: &trueValue}, globalProvisionerClaims),
  393. }, &x509.Certificate{
  394. NotBefore: now.Add(-time.Hour),
  395. NotAfter: now.Add(-time.Minute),
  396. }}, false},
  397. {"fail disabled", args{ctx, &Controller{
  398. Interface: &JWK{},
  399. Claimer: mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims),
  400. }, &x509.Certificate{
  401. NotBefore: now,
  402. NotAfter: now.Add(time.Hour),
  403. }}, true},
  404. {"fail not yet valid", args{ctx, &Controller{
  405. Interface: &JWK{},
  406. Claimer: mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims),
  407. }, &x509.Certificate{
  408. NotBefore: now.Add(time.Hour),
  409. NotAfter: now.Add(2 * time.Hour),
  410. }}, true},
  411. {"fail expired", args{ctx, &Controller{
  412. Interface: &JWK{},
  413. Claimer: mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims),
  414. }, &x509.Certificate{
  415. NotBefore: now.Add(-time.Hour),
  416. NotAfter: now.Add(-time.Minute),
  417. }}, true},
  418. }
  419. for _, tt := range tests {
  420. t.Run(tt.name, func(t *testing.T) {
  421. if err := DefaultAuthorizeRenew(tt.args.ctx, tt.args.p, tt.args.cert); (err != nil) != tt.wantErr {
  422. t.Errorf("DefaultAuthorizeRenew() error = %v, wantErr %v", err, tt.wantErr)
  423. }
  424. })
  425. }
  426. }
  427. func TestDefaultAuthorizeSSHRenew(t *testing.T) {
  428. ctx := context.Background()
  429. now := time.Now()
  430. type args struct {
  431. ctx context.Context
  432. p *Controller
  433. cert *ssh.Certificate
  434. }
  435. tests := []struct {
  436. name string
  437. args args
  438. wantErr bool
  439. }{
  440. {"ok", args{ctx, &Controller{
  441. Interface: &JWK{},
  442. Claimer: mustClaimer(t, nil, globalProvisionerClaims),
  443. }, &ssh.Certificate{
  444. ValidAfter: uint64(now.Unix()),
  445. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  446. }}, false},
  447. {"ok renew after expiry", args{ctx, &Controller{
  448. Interface: &JWK{},
  449. Claimer: mustClaimer(t, &Claims{AllowRenewalAfterExpiry: &trueValue}, globalProvisionerClaims),
  450. }, &ssh.Certificate{
  451. ValidAfter: uint64(now.Add(-time.Hour).Unix()),
  452. ValidBefore: uint64(now.Add(-time.Minute).Unix()),
  453. }}, false},
  454. {"fail disabled", args{ctx, &Controller{
  455. Interface: &JWK{},
  456. Claimer: mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims),
  457. }, &ssh.Certificate{
  458. ValidAfter: uint64(now.Unix()),
  459. ValidBefore: uint64(now.Add(time.Hour).Unix()),
  460. }}, true},
  461. {"fail not yet valid", args{ctx, &Controller{
  462. Interface: &JWK{},
  463. Claimer: mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims),
  464. }, &ssh.Certificate{
  465. ValidAfter: uint64(now.Add(time.Hour).Unix()),
  466. ValidBefore: uint64(now.Add(2 * time.Hour).Unix()),
  467. }}, true},
  468. {"fail expired", args{ctx, &Controller{
  469. Interface: &JWK{},
  470. Claimer: mustClaimer(t, &Claims{DisableRenewal: &trueValue}, globalProvisionerClaims),
  471. }, &ssh.Certificate{
  472. ValidAfter: uint64(now.Add(-time.Hour).Unix()),
  473. ValidBefore: uint64(now.Add(-time.Minute).Unix()),
  474. }}, true},
  475. }
  476. for _, tt := range tests {
  477. t.Run(tt.name, func(t *testing.T) {
  478. if err := DefaultAuthorizeSSHRenew(tt.args.ctx, tt.args.p, tt.args.cert); (err != nil) != tt.wantErr {
  479. t.Errorf("DefaultAuthorizeSSHRenew() error = %v, wantErr %v", err, tt.wantErr)
  480. }
  481. })
  482. }
  483. }
  484. func Test_newWebhookController(t *testing.T) {
  485. cert, err := pemutil.ReadCertificate("testdata/certs/x5c-leaf.crt", pemutil.WithFirstBlock())
  486. if err != nil {
  487. t.Fatal(err)
  488. }
  489. opts := []webhook.RequestBodyOption{webhook.WithX5CCertificate(cert)}
  490. type args struct {
  491. templateData WebhookSetter
  492. certType linkedca.Webhook_CertType
  493. opts []webhook.RequestBodyOption
  494. }
  495. tests := []struct {
  496. name string
  497. args args
  498. want *WebhookController
  499. }{
  500. {"ok", args{x509util.TemplateData{"foo": "bar"}, linkedca.Webhook_X509, nil}, &WebhookController{
  501. TemplateData: x509util.TemplateData{"foo": "bar"},
  502. certType: linkedca.Webhook_X509,
  503. client: http.DefaultClient,
  504. }},
  505. {"ok with options", args{x509util.TemplateData{"foo": "bar"}, linkedca.Webhook_SSH, opts}, &WebhookController{
  506. TemplateData: x509util.TemplateData{"foo": "bar"},
  507. certType: linkedca.Webhook_SSH,
  508. client: http.DefaultClient,
  509. options: opts,
  510. }},
  511. }
  512. for _, tt := range tests {
  513. c := Controller{
  514. webhookClient: new(http.Client),
  515. wrapTransport: httptransport.NoopWrapper(),
  516. }
  517. got := c.newWebhookController(tt.args.templateData, tt.args.certType, tt.args.opts...)
  518. assert.Equal(t, tt.args.templateData, got.TemplateData)
  519. assert.Same(t, c.webhookClient, got.client)
  520. assert.Equal(t, c.webhooks, got.webhooks)
  521. assert.Equal(t, tt.args.opts, got.options)
  522. assert.Equal(t, tt.args.certType, got.certType)
  523. }
  524. }