mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Adds DummyOnlyAdminDB() for testing with empty DB
This commit is contained in:
parent
4a1de4a471
commit
dbd8d7ddeb
2 changed files with 8 additions and 1 deletions
|
@ -91,6 +91,13 @@ func DummyInitDB() *gorm.DB {
|
||||||
return test_db
|
return test_db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DummyOnlyAdminDB(test_db *gorm.DB) {
|
||||||
|
|
||||||
|
MigrateModels(test_db)
|
||||||
|
|
||||||
|
checkErr(test_db.Create(&User0).Error)
|
||||||
|
}
|
||||||
|
|
||||||
// Migrates models and populates them with data
|
// Migrates models and populates them with data
|
||||||
func DummyPopulateDB(test_db *gorm.DB) {
|
func DummyPopulateDB(test_db *gorm.DB) {
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ func TestUserEndpoints(t *testing.T) {
|
||||||
|
|
||||||
db := common.DummyInitDB()
|
db := common.DummyInitDB()
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
common.DummyPopulateDB(db)
|
common.DummyOnlyAdminDB(db)
|
||||||
|
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
api := router.Group("/api")
|
api := router.Group("/api")
|
||||||
|
|
Loading…
Add table
Reference in a new issue