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

Function TestSystemCAPoolUnmarshalCaddyfile

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

Source from the content-addressed store, hash-verified

779}
780
781func TestSystemCAPoolUnmarshalCaddyfile(t *testing.T) {
782 type args struct {
783 d *caddyfile.Dispenser
784 }
785 tests := []struct {
786 name string
787 args args
788 wantErr bool
789 }{
790 {
791 name: "basic system pool configuration",
792 args: args{
793 d: caddyfile.NewTestDispenser(`system`),
794 },
795 wantErr: false,
796 },
797 {
798 name: "system pool with arguments produces error",
799 args: args{
800 d: caddyfile.NewTestDispenser(`system foo`),
801 },
802 wantErr: true,
803 },
804 {
805 name: "system pool with block produces error",
806 args: args{
807 d: caddyfile.NewTestDispenser(`system {
808 foo bar
809 }`),
810 },
811 wantErr: true,
812 },
813 }
814 for _, tt := range tests {
815 t.Run(tt.name, func(t *testing.T) {
816 scp := &SystemCAPool{}
817 if err := scp.UnmarshalCaddyfile(tt.args.d); (err != nil) != tt.wantErr {
818 t.Errorf("SystemCAPool.UnmarshalCaddyfile() error = %v, wantErr %v", err, tt.wantErr)
819 }
820 })
821 }
822}
823
824func TestCombinedCAPoolUnmarshalCaddyfile(t *testing.T) {
825 type args struct {

Callers

nothing calls this directly

Calls 2

UnmarshalCaddyfileMethod · 0.95
NewTestDispenserFunction · 0.92

Tested by

no test coverage detected