mirror of https://github.com/golang-jwt/jwt.git
verify that an error is always returned if token.Valid is false (and the reverse)
This commit is contained in:
parent
1b765952cc
commit
c8d4fff6cc
|
@ -183,6 +183,10 @@ func TestParser_Parse(t *testing.T) {
|
||||||
t.Errorf("[%v] Invalid token passed validation", data.name)
|
t.Errorf("[%v] Invalid token passed validation", data.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err == nil && !token.Valid) || (err != nil && token.Valid) {
|
||||||
|
t.Errorf("[%v] Inconsistent behavior between returned error and token.Valid")
|
||||||
|
}
|
||||||
|
|
||||||
if data.errors != 0 {
|
if data.errors != 0 {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("[%v] Expecting error. Didn't get one.", data.name)
|
t.Errorf("[%v] Expecting error. Didn't get one.", data.name)
|
||||||
|
|
Loading…
Reference in New Issue