| 21 | func (f funcMarshaler) MarshalText() ([]byte, error) { return f() } |
| 22 | |
| 23 | func TestCertFile(t *testing.T) { |
| 24 | expected := errors.New("boom") |
| 25 | var short funcMarshaler = func() ([]byte, error) { return []byte(`one`), nil } |
| 26 | var fail funcMarshaler = func() ([]byte, error) { return nil, expected } |
| 27 | |
| 28 | text, err := certFile(short, short, short) |
| 29 | assert.NilError(t, err) |
| 30 | assert.DeepEqual(t, text, []byte(`oneoneone`)) |
| 31 | |
| 32 | text, err = certFile(short, fail, short) |
| 33 | assert.Equal(t, err, expected) |
| 34 | assert.DeepEqual(t, text, []byte(nil)) |
| 35 | } |
| 36 | |
| 37 | func TestClientCommonName(t *testing.T) { |
| 38 | t.Parallel() |