uniugm/admin/lib/tokenlib/token_test.go

21 lines
318 B
Go
Raw Normal View History

2025-04-30 15:46:14 +08:00
package tokenlib
import (
"testing"
"time"
)
func TestToken(t *testing.T) {
token, err := GenToken(123, time.Second*5)
if err != nil {
panic(err)
}
if err := ValidToken(token, 123); err != nil {
panic(err)
}
time.Sleep(time.Second * 6)
if err := ValidToken(token, 123); err == nil {
panic(token)
}
}