File: cust_integ_eventstream_test.go

package info (click to toggle)
golang-github-aws-aws-sdk-go 1.49.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312,636 kB
  • sloc: makefile: 120
file content (42 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//go:build integration
// +build integration

package lexruntimev2

import (
	"testing"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/awstesting/integration"
)

func TestInteg_StartConversation_errorCase(t *testing.T) {
	sess := integration.SessionWithDefaultRegion("us-west-2")

	client := New(sess, &aws.Config{
		Logger:   t,
		LogLevel: aws.LogLevel(aws.LogDebugWithEventStreamBody | aws.LogDebugWithHTTPBody),
	})

	_, err := client.StartConversation(&StartConversationInput{
		BotAliasId: aws.String("mockAlias"),
		BotId:      aws.String("mockId01234567890"),
		LocaleId:   aws.String("mockLocale"),
		SessionId:  aws.String("mockSession"),
	})
	if err == nil {
		t.Fatalf("expect error, got none")
	}

	aErr, ok := err.(awserr.RequestFailure)
	if !ok {
		t.Fatalf("expect %T error, got %T, %v", aErr, err, err)
	}
	if aErr.Code() == "" {
		t.Errorf("expect error code, got none")
	}
	if aErr.Message() == "" {
		t.Errorf("expect error message, got none")
	}
}