mirror of
https://github.com/hanzoai/porto.git
synced 2026-11-03 18:08:27 +00:00
33 lines
695 B
Go
33 lines
695 B
Go
package gserver
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestParseListenURLs(t *testing.T) {
|
|
cfg := &Config{
|
|
ListenURLs: []string{"https://trusty:2380"},
|
|
}
|
|
|
|
lp, err := cfg.ParseListenURLs()
|
|
require.NoError(t, err)
|
|
assert.Equal(t, 1, len(lp))
|
|
}
|
|
|
|
func TestTLSInfo(t *testing.T) {
|
|
empty := &TLSInfo{}
|
|
assert.True(t, empty.Empty())
|
|
|
|
i := &TLSInfo{
|
|
CertFile: "cert.pem",
|
|
KeyFile: "key.pem",
|
|
TrustedCAFile: "cacerts.pem",
|
|
CRLFile: "123.crl",
|
|
}
|
|
assert.False(t, i.Empty())
|
|
assert.Equal(t, "cert=cert.pem, key=key.pem, trusted-ca=cacerts.pem, client-cert-auth=false, crl-file=123.crl", i.String())
|
|
}
|