28 lines
605 B
Go
28 lines
605 B
Go
package integration
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"gorm.io/driver/sqlite"
|
|
"gorm.io/gorm"
|
|
|
|
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/config"
|
|
"code.alt-gnome.ru/aides-infra/aides-repo-api/internal/models"
|
|
)
|
|
|
|
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",
|
|
}
|
|
}
|