cc2278086f
Feature/import * importstart * pp * tests * importtests * 100GB * lint * passtests * utc * awsprofile * doublequotes * host
46 lines
1010 B
Go
46 lines
1010 B
Go
package documentupload_test
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"queryorchestration/internal/database/repository"
|
|
"queryorchestration/internal/serviceconfig"
|
|
"queryorchestration/internal/serviceconfig/objectstore"
|
|
"queryorchestration/internal/test"
|
|
|
|
documentupload "queryorchestration/internal/document/upload"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
type Config struct {
|
|
serviceconfig.BaseConfig
|
|
objectstore.ObjectStoreConfig
|
|
}
|
|
|
|
func TestUpload(t *testing.T) {
|
|
cfg := &Config{}
|
|
test.CreateDB(t, cfg)
|
|
acfg := test.CreateAWSContainer(t, cfg)
|
|
|
|
test.SetStoreClient(t, t.Context(), cfg, acfg.ExternalEndpoint)
|
|
test.CreateBucket(t, cfg)
|
|
|
|
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
|
|
Clientid: "client_id",
|
|
Name: "client",
|
|
})
|
|
require.NoError(t, err)
|
|
|
|
svc := documentupload.New(cfg)
|
|
|
|
file := documentupload.File{
|
|
ClientID: "client_id",
|
|
Content: strings.NewReader("aaaaaaaaaaaa"),
|
|
}
|
|
|
|
err = svc.Upload(t.Context(), file)
|
|
require.NoError(t, err)
|
|
}
|