Merged in feature/textextraction (pull request #110)
Text Extraction * bases * go * splitting * structure * movetoasync * movetoasync * settinguptrigger * reorder * storevent * standardisepollingvalidation * unittests * fixlint * fixlint * awscfg * generatesample * followthrough * tests * clena * store * externalidcleanup * clientid * local * baseunittests * putobjecttests * tests
This commit is contained in:
+26
-5
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/serviceconfig/aws"
|
||||
"queryorchestration/internal/serviceconfig/objectstore"
|
||||
"queryorchestration/internal/test"
|
||||
queryapitest "queryorchestration/internal/test/queryAPI"
|
||||
@@ -17,15 +18,16 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type ProcessConfig struct {
|
||||
type Config struct {
|
||||
serviceconfig.BaseConfig
|
||||
aws.AWSConfig
|
||||
objectstore.ObjectStoreConfig
|
||||
}
|
||||
|
||||
func TestProcess(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &ProcessConfig{}
|
||||
cfg := &Config{}
|
||||
test.SetCfgProvider(t, cfg)
|
||||
|
||||
net, clean := test.CreateFullNetwork(t, ctx, cfg)
|
||||
@@ -61,10 +63,29 @@ func TestProcess(t *testing.T) {
|
||||
|
||||
queryapitest.WaitForClientStatus(t, ctx, net.Client, client.Id, queryapi.INSYNC)
|
||||
|
||||
filename := "objectname"
|
||||
expectation := test.CreateStartDocTextDetectionExpectation(t, net.Dependencies.MockServer, test.StartDocTextDetectionExpectationParams{
|
||||
Bucket: net.Dependencies.BucketName,
|
||||
ClientID: client.Id,
|
||||
Filename: filename,
|
||||
JobID: "textractId",
|
||||
})
|
||||
|
||||
body := strings.NewReader(pdfHelloWorld)
|
||||
test.PutObject(t, ctx, cfg, client.Uid, net.Dependencies.BucketName, "objectname", body)
|
||||
test.PutImportObject(t, ctx, cfg, test.PutObjectParams{
|
||||
ClientId: client.Id,
|
||||
Bucket: net.Dependencies.BucketName,
|
||||
Filepath: filename,
|
||||
File: body,
|
||||
})
|
||||
|
||||
queryapitest.WaitForClientStatus(t, ctx, net.Client, client.Id, queryapi.NOTSYNCED)
|
||||
|
||||
test.WaitForMockTextractOutput(t, ctx, cfg, net.Dependencies.MockServer, test.TextractOutputParams{
|
||||
Request: expectation.Request,
|
||||
File: body,
|
||||
})
|
||||
|
||||
queryapitest.WaitForClientStatus(t, ctx, net.Client, client.Id, queryapi.INSYNC)
|
||||
|
||||
docs, err := net.Client.ListDocumentsByClientIdWithResponse(ctx, client.Id)
|
||||
@@ -76,7 +97,7 @@ func TestProcess(t *testing.T) {
|
||||
Id: doc.Id,
|
||||
Hash: doc.Hash,
|
||||
ClientId: client.Id,
|
||||
Fields: map[string]interface{}{
|
||||
Fields: map[string]any{
|
||||
"JSON_QUERY": "valueone",
|
||||
},
|
||||
}
|
||||
@@ -95,7 +116,7 @@ func TestProcess(t *testing.T) {
|
||||
Config: &jcfg,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
expectedDoc.Fields = map[string]interface{}{
|
||||
expectedDoc.Fields = map[string]any{
|
||||
"JSON_QUERY": "valuetwo",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user