Backend: Add test fixtures

This commit is contained in:
Theresa Gresch 2020-05-11 17:01:05 +02:00
parent 7cce763864
commit 95ab6dfb94
5 changed files with 435 additions and 6 deletions

View file

@ -43,8 +43,65 @@ var LocationFixtures = LocationMap{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"hassloch": {
ID: "1ef744d1e280",
PlaceID: PlaceFixtures.Get("holidaypark").ID,
Place: PlaceFixtures.Pointer("holidaypark"),
LocName: "Holiday Park",
LocCategory: "",
LocSource: "places",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"emptyNameLongCity": {
ID: "1ef744d1e281",
PlaceID: PlaceFixtures.Get("emptyNameLongCity").ID,
Place: PlaceFixtures.Pointer("emptyNameLongCity"),
LocName: "",
LocCategory: "",
LocSource: "places",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"emptyNameShortCity": {
ID: "1ef744d1e282",
PlaceID: PlaceFixtures.Get("emptyNameShortCity").ID,
Place: PlaceFixtures.Pointer("emptyNameShortCity"),
LocName: "",
LocCategory: "",
LocSource: "places",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"veryLongLocName": {
ID: "1ef744d1e283",
PlaceID: PlaceFixtures.Get("veryLongLocName").ID,
Place: PlaceFixtures.Pointer("veryLongLocName"),
LocName: "longlonglonglonglonglonglonglonglonglonglonglonglongName",
LocCategory: "",
LocSource: "places",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"mediumLongLocName": {
ID: "1ef744d1e283",
PlaceID: PlaceFixtures.Get("mediumLongLocName").ID,
Place: PlaceFixtures.Pointer("mediumLongLocName"),
LocName: "longlonglonglonglonglongName",
LocCategory: "",
LocSource: "places",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
}
var LocationFixturesMexico = LocationFixtures["mexico"]
var LocationFixturesHassloch = LocationFixtures["hassloch"]
var LocationFixturesEmptyNameLongCity = LocationFixtures["emptyNameLongCity"]
var LocationFixturesEmptyNameShortCity = LocationFixtures["emptyNameShortCity"]
var LocationFixturesVeryLongLocName = LocationFixtures["veryLongLocName"]
var LocationFixturesMediumLongLocName = LocationFixtures["mediumLongLocName"]
// CreateLocationFixtures inserts known entities into the database for testing.
func CreateLocationFixtures() {
for _, entity := range LocationFixtures {

View file

@ -39,6 +39,15 @@ var PhotoAlbumFixtures = PhotoAlbumMap{
Photo: PhotoFixtures.Pointer("Photo04"),
Album: AlbumFixtures.Pointer("berlin-2019"),
},
"3": {
PhotoUUID: "pt9jtdre2lvl0yh8",
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),
Photo: PhotoFixtures.Pointer("Photo01"),
Album: AlbumFixtures.Pointer("berlin-2019"),
},
}
// CreatePhotoAlbumFixtures inserts known entities into the database for testing.

View file

@ -181,7 +181,7 @@ var PhotoFixtures = PhotoMap{
ID: 1000003,
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),
TakenAtLocal: time.Time{},
TakenSrc: "exif",
PhotoTitle: "",
TitleSrc: "",
@ -305,7 +305,7 @@ var PhotoFixtures = PhotoMap{
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSerial: "123",
CameraSrc: "",
LensID: 0,
PlaceID: "zz",
@ -444,8 +444,8 @@ var PhotoFixtures = PhotoMap{
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: -21.342636,
PhotoLng: 55.466944,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
@ -455,8 +455,8 @@ var PhotoFixtures = PhotoMap{
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "zz",
LocationID: "",
PlaceID: "85d1ea7d382c",
LocationID: "85d1ea7d382c",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
@ -478,6 +478,300 @@ var PhotoFixtures = PhotoMap{
EditedAt: nil,
DeletedAt: nil,
},
"Photo09": {
ID: 1000009,
PhotoUUID: "pt9jtdre2lvl0y16",
TakenAt: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenAtLocal: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenSrc: "",
PhotoTitle: "Title",
TitleSrc: "",
PhotoPath: "2016/11",
PhotoName: "",
PhotoQuality: 0,
PhotoResolution: 0,
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "85d1ea7d382c",
LocationID: "85d1ea7d382c",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
PhotoYear: 2014,
PhotoMonth: 7,
Description: Description{},
DescriptionSrc: "",
Camera: nil,
Lens: nil,
Location: &LocationFixturesMexico,
Place: PlaceFixtures.Pointer("teotihuacan"),
Links: []Link{},
Keywords: []Keyword{},
Albums: []Album{},
Files: []File{},
Labels: []PhotoLabel{LabelFixtures.PhotoLabel(1000008, "landscape", 20, "image")},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
EditedAt: nil,
DeletedAt: nil,
},
"Photo10": {
ID: 1000010,
PhotoUUID: "pt9jtdre2lvl0y17",
TakenAt: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenAtLocal: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenSrc: "",
PhotoTitle: "Title",
TitleSrc: "",
PhotoPath: "2016/11",
PhotoName: "",
PhotoQuality: 0,
PhotoResolution: 0,
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "",
LocationID: "",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
PhotoYear: 2014,
PhotoMonth: 7,
Description: Description{},
DescriptionSrc: "",
Camera: nil,
Lens: nil,
Location: &LocationFixturesHassloch,
Place: PlaceFixtures.Pointer("holidaypark"),
Links: []Link{},
Keywords: []Keyword{},
Albums: []Album{},
Files: []File{},
Labels: []PhotoLabel{LabelFixtures.PhotoLabel(1000008, "landscape", 20, "image")},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
EditedAt: nil,
DeletedAt: nil,
},
"Photo11": {
ID: 1000011,
PhotoUUID: "pt9jtdre2lvl0y18",
TakenAt: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenAtLocal: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenSrc: "",
PhotoTitle: "Title",
TitleSrc: "",
PhotoPath: "2016/11",
PhotoName: "",
PhotoQuality: 0,
PhotoResolution: 0,
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "",
LocationID: "",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
PhotoYear: 2014,
PhotoMonth: 7,
Description: Description{},
DescriptionSrc: "",
Camera: nil,
Lens: nil,
Location: &LocationFixturesEmptyNameLongCity,
Place: PlaceFixtures.Pointer("emptyNameLongCity"),
Links: []Link{},
Keywords: []Keyword{},
Albums: []Album{},
Files: []File{},
Labels: []PhotoLabel{LabelFixtures.PhotoLabel(1000008, "landscape", 20, "image")},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
EditedAt: nil,
DeletedAt: nil,
},
"Photo12": {
ID: 1000012,
PhotoUUID: "pt9jtdre2lvl0y19",
TakenAt: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenAtLocal: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenSrc: "",
PhotoTitle: "Title",
TitleSrc: "",
PhotoPath: "2016/11",
PhotoName: "",
PhotoQuality: 0,
PhotoResolution: 0,
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "",
LocationID: "",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
PhotoYear: 2014,
PhotoMonth: 7,
Description: Description{},
DescriptionSrc: "",
Camera: nil,
Lens: nil,
Location: &LocationFixturesEmptyNameShortCity,
Place: PlaceFixtures.Pointer("emptyNameShortCity"),
Links: []Link{},
Keywords: []Keyword{},
Albums: []Album{},
Files: []File{},
Labels: []PhotoLabel{LabelFixtures.PhotoLabel(1000008, "landscape", 20, "image")},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
EditedAt: nil,
DeletedAt: nil,
},
"Photo13": {
ID: 1000013,
PhotoUUID: "pt9jtdre2lvl0y20",
TakenAt: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenAtLocal: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenSrc: "",
PhotoTitle: "Title",
TitleSrc: "",
PhotoPath: "2016/11",
PhotoName: "",
PhotoQuality: 0,
PhotoResolution: 0,
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "",
LocationID: "",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
PhotoYear: 2014,
PhotoMonth: 7,
Description: Description{},
DescriptionSrc: "",
Camera: nil,
Lens: nil,
Location: &LocationFixturesVeryLongLocName,
Place: PlaceFixtures.Pointer("veryLongLocName"),
Links: []Link{},
Keywords: []Keyword{},
Albums: []Album{},
Files: []File{},
Labels: []PhotoLabel{LabelFixtures.PhotoLabel(1000008, "landscape", 20, "image")},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
EditedAt: nil,
DeletedAt: nil,
},
"Photo14": {
ID: 1000014,
PhotoUUID: "pt9jtdre2lvl0y21",
TakenAt: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenAtLocal: time.Date(2016, 11, 11, 9, 7, 18, 0, time.UTC),
TakenSrc: "",
PhotoTitle: "Title",
TitleSrc: "",
PhotoPath: "2016/11",
PhotoName: "",
PhotoQuality: 0,
PhotoResolution: 0,
PhotoFavorite: false,
PhotoPrivate: false,
PhotoStory: false,
PhotoLat: 0,
PhotoLng: 0,
PhotoAltitude: 0,
PhotoIso: 0,
PhotoFocalLength: 0,
PhotoFNumber: 0,
PhotoExposure: "",
CameraID: 0,
CameraSerial: "",
CameraSrc: "",
LensID: 0,
PlaceID: "",
LocationID: "",
LocationSrc: "",
TimeZone: "",
PhotoCountry: "zz",
PhotoYear: 2014,
PhotoMonth: 7,
Description: Description{},
DescriptionSrc: "",
Camera: nil,
Lens: nil,
Location: &LocationFixturesMediumLongLocName,
Place: PlaceFixtures.Pointer("mediumLongLocName"),
Links: []Link{},
Keywords: []Keyword{},
Albums: []Album{},
Files: []File{},
Labels: []PhotoLabel{LabelFixtures.PhotoLabel(1000008, "landscape", 20, "image")},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
EditedAt: nil,
DeletedAt: nil,
},
}
// CreatePhotoFixtures inserts known entities into the database for testing.

View file

@ -7,6 +7,10 @@ var PhotoKeywordFixtures = PhotoKeywordMap{
PhotoID: 1000004,
KeywordID: 1000000,
},
"2": {
PhotoID: 1000001,
KeywordID: 1000001,
},
}
// CreatePhotoKeywordFixtures inserts known entities into the database for testing.

View file

@ -47,6 +47,71 @@ var PlaceFixtures = PlacesMap{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"holidaypark": {
ID: "1ef744d1e280",
LocLabel: "Holiday Park, Amusement",
LocCity: "",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"emptyNameLongCity": {
ID: "1ef744d1e281",
LocLabel: "",
LocCity: "longlonglonglonglongcity",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"emptyNameShortCity": {
ID: "1ef744d1e282",
LocLabel: "",
LocCity: "shortcity",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"veryLongLocName": {
ID: "1ef744d1e283",
LocLabel: "",
LocCity: "Mainz",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"mediumLongLocName": {
ID: "1ef744d1e284",
LocLabel: "",
LocCity: "New york",
LocState: "New york",
LocCountry: "us",
LocKeywords: "",
LocNotes: "",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
}
// CreatePlaceFixtures inserts known entities into the database for testing.