photoprism/internal/entity/file_sync_test.go

26 lines
620 B
Go
Raw Normal View History

2020-05-08 10:21:03 +02:00
package entity
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestFileSync_TableName(t *testing.T) {
fileSync := &FileSync{}
assert.Equal(t, "files_sync", fileSync.TableName())
}
func TestNewFileSync(t *testing.T) {
r := NewFileSync(123, "test")
assert.IsType(t, &FileSync{}, r)
assert.Equal(t, uint(0x7b), r.AccountID)
assert.Equal(t, "test", r.RemoteName)
assert.Equal(t, "new", r.Status)
}
func TestFileSync_FirstOrCreate(t *testing.T) {
2020-05-18 16:37:28 +02:00
fileSync := &FileSync{AccountID: 123, FileID: 888, RemoteName: "test123"}
2020-05-08 10:21:03 +02:00
r := fileSync.FirstOrCreate()
assert.Equal(t, uint(0x7b), r.AccountID)
}