From 6188c7f736ad3217a408cd057718c903bab34fdd Mon Sep 17 00:00:00 2001 From: Theresa Gresch Date: Thu, 30 Apr 2020 17:26:03 +0200 Subject: [PATCH] Backend: Add test fixtures for countries --- internal/entity/country_fixtures.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/entity/country_fixtures.go diff --git a/internal/entity/country_fixtures.go b/internal/entity/country_fixtures.go new file mode 100644 index 000000000..8c14ffcd1 --- /dev/null +++ b/internal/entity/country_fixtures.go @@ -0,0 +1,25 @@ +package entity + +import ( + "github.com/jinzhu/gorm" +) + +var CountryFixtures = map[string]Country{ + "apple-iphone-se": { + ID: "de", + CountrySlug: "germany", + CountryName: "Germany", + CountryDescription: "Country description", + CountryNotes: "Country Notes", + CountryPhoto: nil, + CountryPhotoID: 0, + New: false, + }, +} + +// CreateCountryFixtures inserts known entities into the database for testing. +func CreateCountryFixtures(db *gorm.DB) { + for _, entity := range CountryFixtures { + db.Create(&entity) + } +}