aides-repo-api/tests/integration/utils.go

29 lines
603 B
Go
Raw Normal View History

2024-12-26 16:20:54 +00:00
package integration
import (
"testing"
"github.com/stretchr/testify/assert"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
2024-12-26 17:12:55 +00:00
"code.aides.space/aides-infra/aides-repo-api/internal/config"
"code.aides.space/aides-infra/aides-repo-api/internal/models"
2024-12-26 16:20:54 +00:00
)
func prepareDb(t *testing.T) *gorm.DB {
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
assert.NoError(t, err)
err = db.AutoMigrate(&models.Task{}, &models.GitRepoAltRepoTask{}, &models.RPMFile{})
assert.NoError(t, err)
return db
}
func prepareConfig() *config.Config {
return &config.Config{
UploadDir: "./test_uploads",
}
}