mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
31 lines
540 B
Go
31 lines
540 B
Go
package autocert
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestOcspCache(t *testing.T) {
|
|
c, err := newOCSPCache(10)
|
|
require.NoError(t, err)
|
|
|
|
cases := []struct {
|
|
data []byte
|
|
isUpdated bool
|
|
}{
|
|
{nil, false},
|
|
{nil, false},
|
|
{[]byte("a"), true},
|
|
{[]byte("a"), false},
|
|
{[]byte("b"), true},
|
|
{[]byte("b"), false},
|
|
{nil, true},
|
|
{nil, false},
|
|
}
|
|
|
|
for i, tc := range cases {
|
|
assert.Equal(t, tc.isUpdated, c.updated("key", tc.data), "#%d: %v", i, tc)
|
|
}
|
|
}
|