mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-13 11:56:34 +00:00
29 lines
612 B
Go
29 lines
612 B
Go
package openid
|
|
|
|
import (
|
|
"net/url"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestStateMismatchError(t *testing.T) {
|
|
for _, tt := range []struct {
|
|
name, expected, actual string
|
|
assertion assert.ErrorAssertionFunc
|
|
}{
|
|
{"missing actual state", "expected", "", assert.Error},
|
|
{"state mismatch", "match", "not-match", assert.Error},
|
|
{"state match", "match", "match", assert.NoError},
|
|
} {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
actual := url.Values{
|
|
"state": []string{tt.actual},
|
|
}
|
|
|
|
err := StateMismatchError(actual, tt.expected)
|
|
tt.assertion(t, err)
|
|
})
|
|
}
|
|
}
|