aides-repo-api/tests/integration/utils.go
Maxim Slipenko 0fb274261f
All checks were successful
Format and Lint / format-check (push) Successful in 3m48s
Format and Lint / test (push) Successful in 3m53s
tests: add incorrect upload test
2024-12-26 20:12:55 +03:00

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",
}
}