mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-30 17:37:25 +02:00
authenticate: save oauth2 tokens to cache (#698)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
ef399380b7
commit
666fd6aa35
31 changed files with 1127 additions and 1061 deletions
37
internal/hashutil/hashutil_test.go
Normal file
37
internal/hashutil/hashutil_test.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Package hashutil provides NON-CRYPTOGRAPHIC utility functions for hashing
|
||||
package hashutil
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestHash(t *testing.T) {
|
||||
t.Parallel()
|
||||
tests := []struct {
|
||||
name string
|
||||
v interface{}
|
||||
want uint64
|
||||
}{
|
||||
{"string", "string", 6134271061086542852},
|
||||
{"num", 7, 609900476111905877},
|
||||
{"compound struct", struct {
|
||||
NESCarts []string
|
||||
numberOfCarts int
|
||||
}{
|
||||
[]string{"Battletoads", "Mega Man 1", "Clash at Demonhead"},
|
||||
12,
|
||||
},
|
||||
9061978360207659575},
|
||||
{"compound struct with embedded func (errors!)", struct {
|
||||
AnswerToEverythingFn func() int
|
||||
}{
|
||||
func() int { return 42 },
|
||||
},
|
||||
0},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := Hash(tt.v); got != tt.want {
|
||||
t.Errorf("Hash() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue