Merge pull request #376 from mattmoyer/add-csrftoken-test
Add some trivial unit tests to internal/oidc/csrftoken.
This commit is contained in:
commit
74a8005f92
22
internal/oidc/csrftoken/csrftoken_test.go
Normal file
22
internal/oidc/csrftoken/csrftoken_test.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2021 the Pinniped contributors. All Rights Reserved.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package csrftoken
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCSRFToken(t *testing.T) {
|
||||||
|
tok, err := Generate()
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.Len(t, tok, 64)
|
||||||
|
|
||||||
|
var empty bytes.Buffer
|
||||||
|
tok, err = generate(&empty)
|
||||||
|
require.EqualError(t, err, "could not generate CSRFToken: EOF")
|
||||||
|
require.Empty(t, tok)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user