major refactoring

This commit is contained in:
ston1th 2018-09-13 11:39:49 +02:00
commit f2d57c6e18
4 changed files with 87 additions and 89 deletions

View file

@ -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"))