major refactoring
This commit is contained in:
parent
826d035d3e
commit
f2d57c6e18
4 changed files with 87 additions and 89 deletions
15
jwt_test.go
15
jwt_test.go
|
|
@ -42,6 +42,20 @@ func TestValidate(t *testing.T) {
|
|||
t.Error(errors.New("token should be expired"))
|
||||
}
|
||||
|
||||
err = jwt.Invalidate(nt)
|
||||
if err == nil {
|
||||
t.Error(errors.New("token is expired"))
|
||||
}
|
||||
|
||||
err = jwt.Sign(nt)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
err = jwt.Verify(nt)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
err = jwt.Invalidate(nt)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
|
@ -50,6 +64,7 @@ func TestValidate(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Error(errors.New("double invalidate"))
|
||||
}
|
||||
|
||||
err = jwt.Verify(nt)
|
||||
if err == nil {
|
||||
t.Error(errors.New("token should be blacklisted"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue