19 lines
330 B
Go
19 lines
330 B
Go
package csrf
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestTokenGeneration(t *testing.T) {
|
|
var tokenLength uint = 8
|
|
|
|
token, err := generateCSRFToken(tokenLength)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
actualTokenLength := uint(len(token))
|
|
if actualTokenLength != tokenLength {
|
|
t.Errorf("incorrect token length: %d", actualTokenLength)
|
|
}
|
|
}
|