photoprism/internal/hub/session_test.go

27 lines
468 B
Go
Raw Normal View History

2020-12-04 13:10:32 +01:00
package hub
2020-10-20 11:05:02 +02:00
import (
"testing"
"time"
2020-11-21 18:08:41 +01:00
"github.com/stretchr/testify/assert"
2020-10-20 11:05:02 +02:00
)
func TestSession_Expired(t *testing.T) {
t.Run("empty", func(t *testing.T) {
session := Session{
MapKey: "",
ExpiresAt: "",
}
assert.True(t, session.Expired())
})
t.Run("true", func(t *testing.T) {
date := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
session := Session{
MapKey: "",
ExpiresAt: date.String(),
}
assert.True(t, session.Expired())
})
}