Golang How should I write the return value of the S3.SelectObjectContent mock?

0

I'm unit testing the process using S3's SelectObjectContent.
Replace SelectObjectContent with a mock of s3iface.
But I don't know how to create a mock response to get the e.Payload.
Please tell me how to get e.Payload by the SelectObjectContent mock.

process

resp, err := svc.SelectObjectContent(params)
if err != nil {
	return err
}
defer resp.EventStream.Close()

for event := range resp.EventStream.Events() {
	switch e := event.(type) {
	case *s3.RecordsEvent:
		fmt.Println(string(e.Payload))
	}
}

** Mock **

type mockS3Client struct {
    s3iface.S3API
}

func (m *mockS3Client) SelectObjectContent(input *s3.SelectObjectContentInput) (*s3.SelectObjectContentOutput, error) {
    // mock response/functionality
}
asked 2 years ago110 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions