MCPcopy
hub / github.com/caddyserver/caddy / TestTLSConfig_unmarshalCaddyfile

Function TestTLSConfig_unmarshalCaddyfile

modules/caddytls/capools_test.go:481–656  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

479}
480
481func TestTLSConfig_unmarshalCaddyfile(t *testing.T) {
482 type args struct {
483 d *caddyfile.Dispenser
484 }
485 tests := []struct {
486 name string
487 args args
488 expected TLSConfig
489 wantErr bool
490 }{
491 {
492 name: "no arguments is valid",
493 args: args{
494 d: caddyfile.NewTestDispenser(` {
495 }`),
496 },
497 expected: TLSConfig{},
498 },
499 {
500 name: "setting 'renegotiation' to 'never' is valid",
501 args: args{
502 d: caddyfile.NewTestDispenser(` {
503 renegotiation never
504 }`),
505 },
506 expected: TLSConfig{
507 Renegotiation: "never",
508 },
509 },
510 {
511 name: "setting 'renegotiation' to 'once' is valid",
512 args: args{
513 d: caddyfile.NewTestDispenser(` {
514 renegotiation once
515 }`),
516 },
517 expected: TLSConfig{
518 Renegotiation: "once",
519 },
520 },
521 {
522 name: "setting 'renegotiation' to 'freely' is valid",
523 args: args{
524 d: caddyfile.NewTestDispenser(` {
525 renegotiation freely
526 }`),
527 },
528 expected: TLSConfig{
529 Renegotiation: "freely",
530 },
531 },
532 {
533 name: "setting 'renegotiation' to other than 'none', 'once, or 'freely' is invalid",
534 args: args{
535 d: caddyfile.NewTestDispenser(` {
536 renegotiation foo
537 }`),
538 },

Callers

nothing calls this directly

Calls 3

unmarshalCaddyfileMethod · 0.95
NewTestDispenserFunction · 0.92
DurationMethod · 0.80

Tested by

no test coverage detected