:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
package config
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestCredentials_IsExpired(t *testing.T) {
tests := []struct {
name string
expiresAt time.Time
expected bool
}{
{"not expired", time.Now().Add(time.Hour), false},
{"expired", time.Now().Add(-time.Hour), true},
{"just expired", time.Now().Add(-time.Second), true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
creds := &Credentials{ExpiresAt: tt.expiresAt}
assert.Equal(t, tt.expected, creds.IsExpired())
})
}
}