mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
use copies of global test data when adding users to DB, add a function that adds admin and 2 normal users to DB
This commit is contained in:
parent
0d389e9cd5
commit
3963bb37a4
1 changed files with 19 additions and 1 deletions
|
@ -94,7 +94,25 @@ func DummyInitDB() *gorm.DB {
|
|||
|
||||
func DummyAddOnlyUserTableWithAdminDB(db *gorm.DB) {
|
||||
db.AutoMigrate(&User{})
|
||||
checkErr(db.Create(&User0).Error)
|
||||
|
||||
//create a copy of global test data
|
||||
user0 := User0
|
||||
// add admin user to DB
|
||||
checkErr(db.Create(&user0).Error)
|
||||
}
|
||||
|
||||
func DummyAddOnlyUserTableWithAdminAndUsersDB(db *gorm.DB) {
|
||||
db.AutoMigrate(&User{})
|
||||
|
||||
//create a copy of global test data
|
||||
user0 := User0
|
||||
userA := UserA
|
||||
userB := UserB
|
||||
// add admin user to DB
|
||||
checkErr(db.Create(&user0).Error)
|
||||
// add normal users to DB
|
||||
checkErr(db.Create(&userA).Error)
|
||||
checkErr(db.Create(&userB).Error)
|
||||
}
|
||||
|
||||
// Migrates models and populates them with data
|
||||
|
|
Loading…
Add table
Reference in a new issue