Backend: Add test fixtures
This commit is contained in:
parent
9e343cef04
commit
6edb578b34
|
@ -1,15 +1,14 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
var AlbumFixtures = map[string]Album{
|
||||
"christmas2030": {
|
||||
ID: 1000000,
|
||||
CoverUUID: nil,
|
||||
AlbumUUID: "aq9lxuqxpogaaba7",
|
||||
CoverUUID: "",
|
||||
AlbumUUID: "at9lxuqxpogaaba7",
|
||||
AlbumSlug: "christmas2030",
|
||||
AlbumName: "Christmas2030",
|
||||
AlbumDescription: "Wonderful christmas",
|
||||
|
@ -24,8 +23,8 @@ var AlbumFixtures = map[string]Album{
|
|||
},
|
||||
"holiday-2030": {
|
||||
ID: 1000001,
|
||||
CoverUUID: nil,
|
||||
AlbumUUID: "aq9lxuqxpogaaba8",
|
||||
CoverUUID: "",
|
||||
AlbumUUID: "at9lxuqxpogaaba8",
|
||||
AlbumSlug: "holiday-2030",
|
||||
AlbumName: "Holiday2030",
|
||||
AlbumDescription: "Wonderful christmas",
|
||||
|
@ -40,8 +39,8 @@ var AlbumFixtures = map[string]Album{
|
|||
},
|
||||
"berlin-2019": {
|
||||
ID: 1000002,
|
||||
CoverUUID: nil,
|
||||
AlbumUUID: "aq9lxuqxpogaaba9",
|
||||
CoverUUID: "",
|
||||
AlbumUUID: "at9lxuqxpogaaba9",
|
||||
AlbumSlug: "berlin-2019",
|
||||
AlbumName: "Berlin2019",
|
||||
AlbumDescription: "Wonderful christmas",
|
||||
|
@ -56,9 +55,12 @@ var AlbumFixtures = map[string]Album{
|
|||
},
|
||||
}
|
||||
|
||||
var AlbumFixtureHoliday2030 = AlbumFixtures["holiday-2030"]
|
||||
var AlbumFixtureBerlin2019 = AlbumFixtures["berlin-2019"]
|
||||
|
||||
// CreateAlbumFixtures inserts known entities into the database for testing.
|
||||
func CreateAlbumFixtures(db *gorm.DB) {
|
||||
func CreateAlbumFixtures() {
|
||||
for _, entity := range AlbumFixtures {
|
||||
db.Create(&entity)
|
||||
Db().Create(&entity)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package entity
|
|||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
var CameraFixtures = map[string]Camera{
|
||||
|
@ -84,8 +82,8 @@ var CameraFixtures = map[string]Camera{
|
|||
var CameraFixtureEOS6D = CameraFixtures["canon-eos-6d"]
|
||||
|
||||
// CreateCameraFixtures inserts known entities into the database for testing.
|
||||
func CreateCameraFixtures(db *gorm.DB) {
|
||||
func CreateCameraFixtures() {
|
||||
for _, entity := range CameraFixtures {
|
||||
db.Create(&entity)
|
||||
Db().Create(&entity)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
var CountryFixtures = map[string]Country{
|
||||
"apple-iphone-se": {
|
||||
ID: "de",
|
||||
|
@ -18,8 +14,8 @@ var CountryFixtures = map[string]Country{
|
|||
}
|
||||
|
||||
// CreateCountryFixtures inserts known entities into the database for testing.
|
||||
func CreateCountryFixtures(db *gorm.DB) {
|
||||
func CreateCountryFixtures() {
|
||||
for _, entity := range CountryFixtures {
|
||||
db.Create(&entity)
|
||||
Db().Create(&entity)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ var FileFixtures = map[string]File{
|
|||
ID: 1000000,
|
||||
Photo: &PhotoFixture19800101_000002_D640C559,
|
||||
PhotoID: 1000000,
|
||||
PhotoUUID: "1jxf3jfn2k",
|
||||
FileUUID: "fq8es39w45bnlqdw",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh7",
|
||||
FileUUID: "ft8es39w45bnlqdw",
|
||||
FileName: "exampleFileName.jpg",
|
||||
OriginalName: "exampleFileNameOriginal.jpg",
|
||||
FileHash: "2cad9168fa6acc5c5c2965ddf6ec465ca42fd818",
|
||||
|
@ -48,8 +48,8 @@ var FileFixtures = map[string]File{
|
|||
ID: 1000001,
|
||||
Photo: &PhotoFixturePhoto01,
|
||||
PhotoID: 1000001,
|
||||
PhotoUUID: "1jxf3jfn2k",
|
||||
FileUUID: "rq8es39w45bnlqdw",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh8",
|
||||
FileUUID: "ft9es39w45bnlqdw",
|
||||
FileName: "exampleDNGFile.dng",
|
||||
OriginalName: "exampleDNGFile.dng",
|
||||
FileHash: "3cad9168fa6acc5c5c2965ddf6ec465ca42fd818",
|
||||
|
@ -87,8 +87,8 @@ var FileFixtures = map[string]File{
|
|||
ID: 1000002,
|
||||
Photo: &PhotoFixturePhoto01,
|
||||
PhotoID: 1000001,
|
||||
PhotoUUID: "1jxf3jfn2k",
|
||||
FileUUID: "9q8es39w45bnlqdw",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh8",
|
||||
FileUUID: "ft1es39w45bnlqdw",
|
||||
FileName: "exampleXmpFile.xmp",
|
||||
OriginalName: "exampleXmpFile.xmp",
|
||||
FileHash: "ocad9168fa6acc5c5c2965ddf6ec465ca42fd818",
|
||||
|
@ -126,8 +126,8 @@ var FileFixtures = map[string]File{
|
|||
ID: 1000003,
|
||||
Photo: &PhotoFixturePhoto04,
|
||||
PhotoID: 1000004,
|
||||
PhotoUUID: "pq9jtdre2lvl0y11",
|
||||
FileUUID: "pq8es39w45bnlqdw",
|
||||
PhotoUUID: "pt9jtdre2lvl0y11",
|
||||
FileUUID: "ft2es39w45bnlqdw",
|
||||
FileName: "bridge.jpg",
|
||||
OriginalName: "bridgeOriginal.jpg",
|
||||
FileHash: "pcad9168fa6acc5c5c2965ddf6ec465ca42fd818",
|
||||
|
@ -165,8 +165,8 @@ var FileFixtures = map[string]File{
|
|||
ID: 1000004,
|
||||
Photo: &PhotoFixturePhoto05,
|
||||
PhotoID: 1000005,
|
||||
PhotoUUID: "pq9jtdre2lvl0y12",
|
||||
FileUUID: "aq8es39w45bnlqdw",
|
||||
PhotoUUID: "pt9jtdre2lvl0y12",
|
||||
FileUUID: "ft3es39w45bnlqdw",
|
||||
FileName: "reunion.jpg",
|
||||
OriginalName: "reunionOriginal.jpg",
|
||||
FileHash: "acad9168fa6acc5c5c2965ddf6ec465ca42fd818",
|
||||
|
|
|
@ -61,7 +61,7 @@ var LabelFixtures = map[string]Label{
|
|||
LabelUUID: "lt9k3pw1wowuy3c5",
|
||||
LabelSlug: "cow",
|
||||
CustomSlug: "kuh",
|
||||
LabelName: "Cow",
|
||||
LabelName: "COW",
|
||||
LabelPriority: -1,
|
||||
LabelFavorite: true,
|
||||
LabelDescription: "",
|
||||
|
@ -75,6 +75,10 @@ var LabelFixtures = map[string]Label{
|
|||
},
|
||||
}
|
||||
|
||||
var LabelFixtureLandscape = LabelFixtures["landscape"]
|
||||
var LabelFixtureFlower = LabelFixtures["flower"]
|
||||
var LabelFixtureCake = LabelFixtures["cake"]
|
||||
|
||||
// CreateLabelFixtures inserts known entities into the database for testing.
|
||||
func CreateLabelFixtures() {
|
||||
for _, entity := range LabelFixtures {
|
||||
|
|
|
@ -4,8 +4,8 @@ import "time"
|
|||
|
||||
var PhotoAlbumFixtures = map[string]PhotoAlbum{
|
||||
"1": {
|
||||
PhotoUUID: "1jxf3jfn2k",
|
||||
AlbumUUID: "pq9jtdre2lvl0yh7",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh7",
|
||||
AlbumUUID: "at9lxuqxpogaaba8",
|
||||
Order: 0,
|
||||
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
|
||||
UpdatedAt: time.Date(2020, 3, 28, 14, 6, 0, 0, time.UTC),
|
||||
|
@ -13,8 +13,8 @@ var PhotoAlbumFixtures = map[string]PhotoAlbum{
|
|||
Album: &AlbumFixtureHoliday2030,
|
||||
},
|
||||
"2": {
|
||||
PhotoUUID: "pq9jtdre2lvl0y11",
|
||||
AlbumUUID: "aq9lxuqxpogaaba9",
|
||||
PhotoUUID: "pt9jtdre2lvl0y11",
|
||||
AlbumUUID: "at9lxuqxpogaaba9",
|
||||
Order: 0,
|
||||
CreatedAt: time.Date(2020, 2, 6, 2, 6, 51, 0, time.UTC),
|
||||
UpdatedAt: time.Date(2020, 4, 28, 14, 6, 0, 0, time.UTC),
|
||||
|
|
|
@ -2,14 +2,12 @@ package entity
|
|||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
var PhotoFixtures = map[string]Photo{
|
||||
"19800101_000002_D640C559": {
|
||||
ID: 1000000,
|
||||
PhotoUUID: "pq9jtdre2lvl0yh7",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh7",
|
||||
TakenAt: time.Date(2008, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
TakenAtLocal: time.Date(2008, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
TakenSrc: "exif",
|
||||
|
@ -25,14 +23,14 @@ var PhotoFixtures = map[string]Photo{
|
|||
PhotoLat: 48.519234,
|
||||
PhotoLng: 9.057997,
|
||||
PhotoAltitude: 0,
|
||||
PhotoIso: nil,
|
||||
PhotoFocalLength: nil,
|
||||
PhotoFNumber: nil,
|
||||
PhotoIso: 0,
|
||||
PhotoFocalLength: 0,
|
||||
PhotoFNumber: 0,
|
||||
PhotoExposure: "",
|
||||
CameraID: nil,
|
||||
CameraID: 0,
|
||||
CameraSerial: "",
|
||||
CameraSrc: "",
|
||||
LensID: nil,
|
||||
LensID: 0,
|
||||
PlaceID: "zz",
|
||||
LocationID: "",
|
||||
LocationSrc: "",
|
||||
|
@ -58,7 +56,7 @@ var PhotoFixtures = map[string]Photo{
|
|||
},
|
||||
"Photo01": {
|
||||
ID: 1000001,
|
||||
PhotoUUID: "pq9jtdre2lvl0yh8",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh8",
|
||||
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",
|
||||
|
@ -68,20 +66,20 @@ var PhotoFixtures = map[string]Photo{
|
|||
PhotoName: "Photo01",
|
||||
PhotoQuality: 3,
|
||||
PhotoResolution: 2,
|
||||
PhotoFavorite: false,
|
||||
PhotoFavorite: true,
|
||||
PhotoPrivate: false,
|
||||
PhotoStory: false,
|
||||
PhotoLat: 48.519234,
|
||||
PhotoLng: 9.057997,
|
||||
PhotoAltitude: 0,
|
||||
PhotoIso: nil,
|
||||
PhotoFocalLength: nil,
|
||||
PhotoFNumber: nil,
|
||||
PhotoIso: 0,
|
||||
PhotoFocalLength: 0,
|
||||
PhotoFNumber: 0,
|
||||
PhotoExposure: "",
|
||||
CameraID: nil,
|
||||
CameraID: 0,
|
||||
CameraSerial: "",
|
||||
CameraSrc: "",
|
||||
LensID: nil,
|
||||
LensID: 0,
|
||||
PlaceID: "zz",
|
||||
LocationID: "",
|
||||
LocationSrc: "",
|
||||
|
@ -107,7 +105,7 @@ var PhotoFixtures = map[string]Photo{
|
|||
},
|
||||
"Photo02": {
|
||||
ID: 1000002,
|
||||
PhotoUUID: "pq9jtdre2lvl0yh9",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh9",
|
||||
TakenAt: time.Date(2008, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
TakenAtLocal: time.Date(2008, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
TakenSrc: "exif",
|
||||
|
@ -123,14 +121,14 @@ var PhotoFixtures = map[string]Photo{
|
|||
PhotoLat: 48.519234,
|
||||
PhotoLng: 9.057997,
|
||||
PhotoAltitude: 0,
|
||||
PhotoIso: nil,
|
||||
PhotoFocalLength: nil,
|
||||
PhotoFNumber: nil,
|
||||
PhotoIso: 0,
|
||||
PhotoFocalLength: 0,
|
||||
PhotoFNumber: 0,
|
||||
PhotoExposure: "",
|
||||
CameraID: nil,
|
||||
CameraID: 0,
|
||||
CameraSerial: "",
|
||||
CameraSrc: "",
|
||||
LensID: nil,
|
||||
LensID: 0,
|
||||
PlaceID: "zz",
|
||||
LocationID: "",
|
||||
LocationSrc: "",
|
||||
|
@ -156,7 +154,7 @@ var PhotoFixtures = map[string]Photo{
|
|||
},
|
||||
"Photo03": {
|
||||
ID: 1000003,
|
||||
PhotoUUID: "pq9jtdre2lvl0yh0",
|
||||
PhotoUUID: "pt9jtdre2lvl0yh0",
|
||||
TakenAt: time.Date(2008, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
TakenAtLocal: time.Date(2008, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
TakenSrc: "exif",
|
||||
|
@ -172,14 +170,14 @@ var PhotoFixtures = map[string]Photo{
|
|||
PhotoLat: 48.519234,
|
||||
PhotoLng: 9.057997,
|
||||
PhotoAltitude: 0,
|
||||
PhotoIso: nil,
|
||||
PhotoFocalLength: nil,
|
||||
PhotoFNumber: nil,
|
||||
PhotoIso: 0,
|
||||
PhotoFocalLength: 0,
|
||||
PhotoFNumber: 0,
|
||||
PhotoExposure: "",
|
||||
CameraID: nil,
|
||||
CameraID: 0,
|
||||
CameraSerial: "",
|
||||
CameraSrc: "",
|
||||
LensID: nil,
|
||||
LensID: 0,
|
||||
PlaceID: "zz",
|
||||
LocationID: "",
|
||||
LocationSrc: "",
|
||||
|
@ -205,7 +203,7 @@ var PhotoFixtures = map[string]Photo{
|
|||
},
|
||||
"Photo04": {
|
||||
ID: 1000004,
|
||||
PhotoUUID: "pq9jtdre2lvl0y11",
|
||||
PhotoUUID: "pt9jtdre2lvl0y11",
|
||||
TakenAt: time.Date(2014, 7, 17, 15, 42, 12, 0, time.UTC),
|
||||
TakenAtLocal: time.Date(2014, 7, 17, 15, 42, 12, 0, time.UTC),
|
||||
TakenSrc: "exif",
|
||||
|
@ -221,14 +219,14 @@ var PhotoFixtures = map[string]Photo{
|
|||
PhotoLat: 48.519234,
|
||||
PhotoLng: 9.057997,
|
||||
PhotoAltitude: 0,
|
||||
PhotoIso: nil,
|
||||
PhotoFocalLength: nil,
|
||||
PhotoFNumber: nil,
|
||||
PhotoIso: 0,
|
||||
PhotoFocalLength: 0,
|
||||
PhotoFNumber: 0,
|
||||
PhotoExposure: "",
|
||||
CameraID: nil,
|
||||
CameraID: 0,
|
||||
CameraSerial: "",
|
||||
CameraSrc: "",
|
||||
LensID: nil,
|
||||
LensID: 0,
|
||||
PlaceID: "zz",
|
||||
LocationID: "",
|
||||
LocationSrc: "",
|
||||
|
@ -254,7 +252,7 @@ var PhotoFixtures = map[string]Photo{
|
|||
},
|
||||
"Photo05": {
|
||||
ID: 1000005,
|
||||
PhotoUUID: "pq9jtdre2lvl0y12",
|
||||
PhotoUUID: "pt9jtdre2lvl0y12",
|
||||
TakenAt: time.Date(2015, 11, 11, 9, 7, 18, 0, time.UTC),
|
||||
TakenAtLocal: time.Date(2015, 11, 11, 9, 7, 18, 0, time.UTC),
|
||||
TakenSrc: "exif",
|
||||
|
@ -270,14 +268,14 @@ var PhotoFixtures = map[string]Photo{
|
|||
PhotoLat: -21.342636,
|
||||
PhotoLng: 55.466944,
|
||||
PhotoAltitude: 0,
|
||||
PhotoIso: nil,
|
||||
PhotoFocalLength: nil,
|
||||
PhotoFNumber: nil,
|
||||
PhotoIso: 0,
|
||||
PhotoFocalLength: 0,
|
||||
PhotoFNumber: 0,
|
||||
PhotoExposure: "",
|
||||
CameraID: nil,
|
||||
CameraID: 0,
|
||||
CameraSerial: "",
|
||||
CameraSrc: "",
|
||||
LensID: nil,
|
||||
LensID: 0,
|
||||
PlaceID: "zz",
|
||||
LocationID: "",
|
||||
LocationSrc: "",
|
||||
|
@ -303,9 +301,14 @@ var PhotoFixtures = map[string]Photo{
|
|||
},
|
||||
}
|
||||
|
||||
var PhotoFixture19800101_000002_D640C559 = PhotoFixtures["19800101_000002_D640C559"]
|
||||
var PhotoFixturePhoto04 = PhotoFixtures["Photo04"]
|
||||
var PhotoFixturePhoto01 = PhotoFixtures["Photo01"]
|
||||
var PhotoFixturePhoto05 = PhotoFixtures["Photo05"]
|
||||
|
||||
// CreatePhotoFixtures inserts known entities into the database for testing.
|
||||
func CreatePhotoFixtures(db *gorm.DB) {
|
||||
func CreatePhotoFixtures() {
|
||||
for _, entity := range PhotoFixtures {
|
||||
db.Create(&entity)
|
||||
Db().Create(&entity)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue