Backend: Add tests to internal/entity
This commit is contained in:
parent
a2d5da7afd
commit
1fdc2cf610
3 changed files with 7 additions and 3 deletions
|
@ -20,7 +20,7 @@ func TestNewFileShare(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileShare_FirstOrCreate(t *testing.T) {
|
func TestFileShare_FirstOrCreate(t *testing.T) {
|
||||||
fileShare := &FileShare{FileID: 123}
|
fileShare := &FileShare{FileID: 123, AccountID: 888, RemoteName: "test888"}
|
||||||
r := fileShare.FirstOrCreate()
|
r := fileShare.FirstOrCreate()
|
||||||
assert.Equal(t, uint(0x7b), r.FileID)
|
assert.Equal(t, uint(0x7b), r.FileID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestNewFileSync(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileSync_FirstOrCreate(t *testing.T) {
|
func TestFileSync_FirstOrCreate(t *testing.T) {
|
||||||
fileSync := &FileSync{AccountID: 123}
|
fileSync := &FileSync{AccountID: 123, FileID: 888, RemoteName: "test123"}
|
||||||
r := fileSync.FirstOrCreate()
|
r := fileSync.FirstOrCreate()
|
||||||
assert.Equal(t, uint(0x7b), r.AccountID)
|
assert.Equal(t, uint(0x7b), r.AccountID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ func TestSavePhotoForm(t *testing.T) {
|
||||||
func TestPhoto_Save(t *testing.T) {
|
func TestPhoto_Save(t *testing.T) {
|
||||||
t.Run("new photo", func(t *testing.T) {
|
t.Run("new photo", func(t *testing.T) {
|
||||||
photo := Photo{
|
photo := Photo{
|
||||||
|
ID: 11111,
|
||||||
TakenAt: time.Date(2008, 1, 1, 2, 0, 0, 0, time.UTC),
|
TakenAt: time.Date(2008, 1, 1, 2, 0, 0, 0, time.UTC),
|
||||||
TakenAtLocal: 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",
|
TakenSrc: "exif",
|
||||||
|
@ -93,7 +94,10 @@ func TestPhoto_Save(t *testing.T) {
|
||||||
LocationID: "1234",
|
LocationID: "1234",
|
||||||
LocationSrc: "geo",
|
LocationSrc: "geo",
|
||||||
PlaceID: "765",
|
PlaceID: "765",
|
||||||
PhotoCountry: "de"}
|
PhotoCountry: "de",
|
||||||
|
Keywords: []Keyword{},
|
||||||
|
Description: Description{},
|
||||||
|
}
|
||||||
|
|
||||||
err := photo.Save()
|
err := photo.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue