713593da4e
You can now run "photoprism auth add" to create new client access tokens that allow external applications to use the built-in REST API. Signed-off-by: Michael Mayer <michael@photoprism.app>
33 lines
645 B
Go
33 lines
645 B
Go
package report
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDateTime(t *testing.T) {
|
|
t.Run("Nil", func(t *testing.T) {
|
|
assert.Equal(t, "", DateTime(nil))
|
|
})
|
|
|
|
t.Run("Zero", func(t *testing.T) {
|
|
assert.Equal(t, "", DateTime(&time.Time{}))
|
|
})
|
|
|
|
t.Run("1665389030", func(t *testing.T) {
|
|
now := time.Unix(1665389030, 0)
|
|
assert.Equal(t, "2022-10-10 08:03:50", DateTime(&now))
|
|
})
|
|
}
|
|
|
|
func TestUnixTime(t *testing.T) {
|
|
t.Run("Zero", func(t *testing.T) {
|
|
assert.Equal(t, "", UnixTime(0))
|
|
})
|
|
|
|
t.Run("1665389030", func(t *testing.T) {
|
|
assert.Equal(t, "2022-10-10 08:03:50", UnixTime(1665389030))
|
|
})
|
|
}
|