func TestClaimsValidity(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	assert.Logf("testing claims validity")
	// Fresh claims.
	now := time.Now()
	leeway := time.Minute
	claims := jwt.NewClaims()
	valid := claims.IsAlreadyValid(leeway)
	assert.True(valid)
	valid = claims.IsStillValid(leeway)
	assert.True(valid)
	valid = claims.IsValid(leeway)
	assert.True(valid)
	// Set times.
	nbf := now.Add(-time.Hour)
	exp := now.Add(time.Hour)
	claims.SetNotBefore(nbf)
	valid = claims.IsAlreadyValid(leeway)
	assert.True(valid)
	claims.SetExpiration(exp)
	valid = claims.IsStillValid(leeway)
	assert.True(valid)
	valid = claims.IsValid(leeway)
	assert.True(valid)
	// Invalid claims.
	nbf = now.Add(time.Hour)
	exp = now.Add(-time.Hour)
	claims.SetNotBefore(nbf)
	claims.DeleteExpiration()
	valid = claims.IsAlreadyValid(leeway)
	assert.False(valid)
	valid = claims.IsValid(leeway)
	assert.False(valid)
	claims.DeleteNotBefore()
	claims.SetExpiration(exp)
	valid = claims.IsStillValid(leeway)
	assert.False(valid)
	valid = claims.IsValid(leeway)
	assert.False(valid)
	claims.SetNotBefore(nbf)
	valid = claims.IsValid(leeway)
	assert.False(valid)
}
// TestClaimsValidity checks the validation of the not before
// and the expiring time.
TestClaimsValidity checks the validation of the not before
and the expiring time.
// TestClaimsValidity checks the validation of the not before // and the expiring time .
func TestClaimsValidity(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	assert.Logf("testing claims validity")
	now := time.Now()
	leeway := time.Minute
	claims := jwt.NewClaims()
	valid := claims.IsAlreadyValid(leeway)
	assert.True(valid)
	valid = claims.IsStillValid(leeway)
	assert.True(valid)
	valid = claims.IsValid(leeway)
	assert.True(valid)
	nbf := now.Add(-time.Hour)
	exp := now.Add(time.Hour)
	claims.SetNotBefore(nbf)
	valid = claims.IsAlreadyValid(leeway)
	assert.True(valid)
	claims.SetExpiration(exp)
	valid = claims.IsStillValid(leeway)
	assert.True(valid)
	valid = claims.IsValid(leeway)
	assert.True(valid)
	nbf = now.Add(time.Hour)
	exp = now.Add(-time.Hour)
	claims.SetNotBefore(nbf)
	claims.DeleteExpiration()
	valid = claims.IsAlreadyValid(leeway)
	assert.False(valid)
	valid = claims.IsValid(leeway)
	assert.False(valid)
	claims.DeleteNotBefore()
	claims.SetExpiration(exp)
	valid = claims.IsStillValid(leeway)
	assert.False(valid)
	valid = claims.IsValid(leeway)
	assert.False(valid)
	claims.SetNotBefore(nbf)
	valid = claims.IsValid(leeway)
	assert.False(valid)
}
func TestClaimsValidity ( t * testing . T ) { assert := audit . NewTestingAssertion ( t , true ) assert . Logf ( " " ) now := time . Now ( ) leeway := time . Minute claims := jwt . NewClaims ( ) valid := claims . IsAlreadyValid ( leeway ) assert . True ( valid ) valid = claims . IsStillValid ( leeway ) assert . True ( valid ) valid = claims . IsValid ( leeway ) assert . True ( valid ) nbf := now . Add ( - time . Hour ) exp := now . Add ( time . Hour ) claims . SetNotBefore ( nbf ) valid = claims . IsAlreadyValid ( leeway ) assert . True ( valid ) claims . SetExpiration ( exp ) valid = claims . IsStillValid ( leeway ) assert . True ( valid ) valid = claims . IsValid ( leeway ) assert . True ( valid ) nbf = now . Add ( time . Hour ) exp = now . Add ( - time . Hour ) claims . SetNotBefore ( nbf ) claims . DeleteExpiration ( ) valid = claims . IsAlreadyValid ( leeway ) assert . False ( valid ) valid = claims . IsValid ( leeway ) assert . False ( valid ) claims . DeleteNotBefore ( ) claims . SetExpiration ( exp ) valid = claims . IsStillValid ( leeway ) assert . False ( valid ) valid = claims . IsValid ( leeway ) assert . False ( valid ) claims . SetNotBefore ( nbf ) valid = claims . IsValid ( leeway ) assert . False ( valid ) }
TestClaimsValidity checks the validation of the not before
and the expiring time.
TestClaimsValidity checks the validation of the not before and the expiring time .
// Fresh claims. // Set times. // Invalid claims.