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