Backend: Add tests to internal/entity

This commit is contained in:
Theresa Gresch 2020-05-18 16:37:28 +02:00
parent a2d5da7afd
commit 1fdc2cf610
3 changed files with 7 additions and 3 deletions

View file

@ -20,7 +20,7 @@ func TestNewFileShare(t *testing.T) {
}
func TestFileShare_FirstOrCreate(t *testing.T) {
fileShare := &FileShare{FileID: 123}
fileShare := &FileShare{FileID: 123, AccountID: 888, RemoteName: "test888"}
r := fileShare.FirstOrCreate()
assert.Equal(t, uint(0x7b), r.FileID)
}

View file

@ -19,7 +19,7 @@ func TestNewFileSync(t *testing.T) {
}
func TestFileSync_FirstOrCreate(t *testing.T) {
fileSync := &FileSync{AccountID: 123}
fileSync := &FileSync{AccountID: 123, FileID: 888, RemoteName: "test123"}
r := fileSync.FirstOrCreate()
assert.Equal(t, uint(0x7b), r.AccountID)
}

View file

@ -71,6 +71,7 @@ func TestSavePhotoForm(t *testing.T) {
func TestPhoto_Save(t *testing.T) {
t.Run("new photo", func(t *testing.T) {
photo := Photo{
ID: 11111,
TakenAt: time.Date(2008, 1, 1, 2, 0, 0, 0, time.UTC),
TakenAtLocal: time.Date(2008, 1, 1, 2, 0, 0, 0, time.UTC),
TakenSrc: "exif",
@ -93,7 +94,10 @@ func TestPhoto_Save(t *testing.T) {
LocationID: "1234",
LocationSrc: "geo",
PlaceID: "765",
PhotoCountry: "de"}
PhotoCountry: "de",
Keywords: []Keyword{},
Description: Description{},
}
err := photo.Save()
if err != nil {