Files
query-orchestration/internal/serviceconfig/textract/config_test.go
T
Michael McGuinness 7ce7c9df4d Merged in feature/ecr (pull request #161)
Feature/ecr

* nosave

* repo

* awscli

* unzip

* ignore

* moreram

* 14k

* ref

* deployment

* 12k

* uselocal

* go

* dockercomd

* reorder

* iamgename

* installs

* tart

* cli

* clideps

* y

* dockerce

* nodock

* multi

* rmecr

* dev
2025-06-03 13:52:10 +00:00

62 lines
1.7 KiB
Go

package textract_test
import (
"testing"
textract "queryorchestration/internal/serviceconfig/textract"
awstextract "github.com/aws/aws-sdk-go-v2/service/textract"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGetTextractClient(t *testing.T) {
c := textract.TextractConfig{}
assert.Nil(t, c.GetTextractClient())
c.TextractClient = &awstextract.Client{}
assert.Equal(t, &awstextract.Client{}, c.GetTextractClient())
}
func TestTextractClient(t *testing.T) {
t.Run("stndard", func(t *testing.T) {
ctx := t.Context()
c := textract.TextractConfig{}
err := c.SetTextractClient(ctx)
require.NoError(t, err)
assert.NotNil(t, c.TextractClient)
})
t.Run("textract specific", func(t *testing.T) {
ctx := t.Context()
c := textract.TextractConfig{
AWSTextractAccessKeyId: "not empty",
AWSTextractSecretAccessKey: "not empty",
AWSTextractSessionToken: "not empty",
AWSTextractRegion: "not empty",
}
err := c.SetTextractClient(ctx)
require.NoError(t, err)
assert.NotNil(t, c.TextractClient)
})
}
func TestTextractClientWithProfile(t *testing.T) {
ctx := t.Context()
c := textract.TextractConfig{}
err := c.SetTextractClientWithProfile(ctx, "")
require.NoError(t, err)
assert.NotNil(t, c.TextractClient)
}
func TestGetTextractURL(t *testing.T) {
c := textract.TextractConfig{}
assert.Empty(t, c.GetTextractEndpoint())
c.AWSEndpointUrlTextract = "textract_endpoint"
assert.Equal(t, "textract_endpoint", c.GetTextractEndpoint())
}
func TestSetTextractURL(t *testing.T) {
c := textract.TextractConfig{}
c.SetTextractEndpoint("example")
assert.Equal(t, "example", c.AWSEndpointUrlTextract)
}