-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
certs_test.go
71 lines (64 loc) · 3.24 KB
/
certs_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) Roman Atachiants and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestTLS_Local(t *testing.T) {
cfg := TLSConfig{
ListenAddr: ":443",
Certificate: testCert,
PrivateKey: testKey,
}
tls, handler, cacher := TLS(&cfg)
assert.NotNil(t, tls)
assert.Nil(t, handler)
assert.NotNil(t, cacher)
}
const testCert = `-----BEGIN CERTIFICATE-----
MIIC+zCCAeOgAwIBAgIJAOfO2qzAuZFFMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
BAMMCWxvY2FsaG9zdDAeFw0xODExMTAwNjQ2MzFaFw0xOTExMTAwNjQ2MzFaMBQx
EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAO/F2I7wUp1exS9kZ77PQJgGDH53uJofi9ADlu9mZ7ui6BITVF7LLtNVbInx
Q0y8Bhe0pW6xC5GpYg6UyG9ctFfB1UilG+/IggvH7BrsJcPelHVtfLPw2dXRhi7V
fDO16x4+XY/wKIGEma7qVHaeg30cTI8K1/6/KnWGuxxsypZj3119H4vG36iTlpAE
AVLrcuB5jFS9xQ4eVeq0ya16h1zjWwb6YYqLB1dTq2YbKq2iuOUfswoQIr52fhyz
pupub95QG9B8Ce5b4nPZLAYHrjJRtSgIe4Cm+B87EnCx6lYw4vBs4dUNb6wCjKpD
yrRbpOsKjUDTWDIO+FLf5InPWS0CAwEAAaNQME4wHQYDVR0OBBYEFJ93b01makOe
Eco9s5oYHrqGEruIMB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