mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
30 lines
486 B
Go
30 lines
486 B
Go
package query
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestAccountByID(t *testing.T) {
|
|
t.Run("ExistingAccount", func(t *testing.T) {
|
|
r, err := AccountByID(uint(1000001))
|
|
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
assert.Equal(t, "Test Account2", r.AccName)
|
|
|
|
})
|
|
t.Run("RecordNotFound", func(t *testing.T) {
|
|
r, err := AccountByID(uint(123))
|
|
|
|
if err == nil {
|
|
t.Fatal()
|
|
}
|
|
assert.Equal(t, "record not found", err.Error())
|
|
assert.Empty(t, r)
|
|
})
|
|
}
|