authenticate: save oauth2 tokens to cache (#698)

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
Bobby DeSimone 2020-05-18 10:45:07 -07:00 committed by Travis Groth
parent ef399380b7
commit 666fd6aa35
31 changed files with 1127 additions and 1061 deletions

View 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)
}
})
}
}