@@ -10,16 +10,12 @@ import (
|
||||
|
||||
queryservice "queryorchestration/api/queryService"
|
||||
"queryorchestration/internal/client"
|
||||
"queryorchestration/internal/collector"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
cleanversion "queryorchestration/internal/document/clean/version"
|
||||
textversion "queryorchestration/internal/document/text/version"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -35,12 +31,7 @@ func TestCreateClient(t *testing.T) {
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
cons := queryservice.NewControllers(validator.New(), &queryservice.Services{
|
||||
Client: client.New(cfg, &client.Services{
|
||||
Collector: collector.New(cfg, &collector.Services{
|
||||
TextVersion: textversion.New(cfg),
|
||||
CleanVersion: cleanversion.New(cfg),
|
||||
}),
|
||||
}),
|
||||
Client: client.New(cfg),
|
||||
})
|
||||
|
||||
body := queryservice.ClientCreate{
|
||||
@@ -61,14 +52,6 @@ func TestCreateClient(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(database.MustToDBUUID(id)),
|
||||
)
|
||||
pool.ExpectBeginTx(pgx.TxOptions{})
|
||||
pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(database.MustToDBUUID(id)).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"version"}).
|
||||
AddRow(int32(1)),
|
||||
)
|
||||
pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(database.MustToDBUUID(id), int32(1)).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
pool.ExpectCommit()
|
||||
|
||||
err = cons.CreateClient(ctx)
|
||||
assert.NoError(t, err)
|
||||
@@ -85,12 +68,7 @@ func TestGetClient(t *testing.T) {
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
cons := queryservice.NewControllers(validator.New(), &queryservice.Services{
|
||||
Client: client.New(cfg, &client.Services{
|
||||
Collector: collector.New(cfg, &collector.Services{
|
||||
TextVersion: textversion.New(cfg),
|
||||
CleanVersion: cleanversion.New(cfg),
|
||||
}),
|
||||
}),
|
||||
Client: client.New(cfg),
|
||||
})
|
||||
|
||||
e := echo.New()
|
||||
@@ -130,12 +108,7 @@ func TestUpdateClient(t *testing.T) {
|
||||
cfg.DBQueries = repository.New(pool)
|
||||
|
||||
cons := queryservice.NewControllers(validator.New(), &queryservice.Services{
|
||||
Client: client.New(cfg, &client.Services{
|
||||
Collector: collector.New(cfg, &collector.Services{
|
||||
TextVersion: textversion.New(cfg),
|
||||
CleanVersion: cleanversion.New(cfg),
|
||||
}),
|
||||
}),
|
||||
Client: client.New(cfg),
|
||||
})
|
||||
|
||||
cs := false
|
||||
|
||||
Reference in New Issue
Block a user