-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
031e67e
commit 06db0ee
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,54 @@ | ||
package smoke_tests | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
af "github.com/Admiral-Piett/goaws/app/fixtures" | ||
"github.com/Admiral-Piett/goaws/app/utils" | ||
"github.com/aws/aws-sdk-go-v2/aws" | ||
"github.com/aws/aws-sdk-go-v2/config" | ||
"github.com/aws/aws-sdk-go-v2/service/sqs" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func Test_SendMessageV1_json_no_attributes(t *testing.T) { | ||
server := generateServer() | ||
defer func() { | ||
server.Close() | ||
utils.ResetResources() | ||
}() | ||
|
||
sdkConfig, _ := config.LoadDefaultConfig(context.TODO()) | ||
sdkConfig.BaseEndpoint = aws.String(server.URL) | ||
sqsClient := sqs.NewFromConfig(sdkConfig) | ||
sdkResponse, _ := sqsClient.CreateQueue(context.TODO(), &sqs.CreateQueueInput{ | ||
QueueName: &af.QueueName, | ||
}) | ||
targetQueueUrl := sdkResponse.QueueUrl | ||
|
||
// TODO: I tried invoke without awssdk but there was an unexpected/unknown error on Xml.Decode on CreateQueue API logic... | ||
// e := httpexpect.Default(t, server.URL) | ||
// r := e.POST("/"). | ||
// WithForm(sf.CreateQueuesRequestBodyXML). | ||
// Expect(). | ||
// Status(http.StatusOK). | ||
// Body().Raw() | ||
// r2 := models.CreateQueueResponse{} | ||
// xml.Unmarshal([]byte(r), &r2) | ||
// targetQueueUrl := r2.Result.QueueUrl | ||
|
||
// Target test | ||
targetMessageBody := "Test_SendMessageV1_json_no_attributes" | ||
// sdkConfig, _ := config.LoadDefaultConfig(context.TODO()) | ||
// sdkConfig.BaseEndpoint = aws.String(server.URL) | ||
// sqsClient := sqs.NewFromConfig(sdkConfig) | ||
sendMessageOutput, _ := sqsClient.SendMessage(context.TODO(), &sqs.SendMessageInput{ | ||
QueueUrl: targetQueueUrl, | ||
MessageBody: &targetMessageBody, | ||
}) | ||
|
||
assert.NotNil(t, sendMessageOutput.MessageId) | ||
|
||
// TODO: Assert message count in queue with GetQueueAttributes API | ||
} |