Skip to content

Commit

Permalink
add multi account support to failing tests in apigateway-sqs integrat…
Browse files Browse the repository at this point in the history
  • Loading branch information
sannya-singal authored Oct 20, 2023
1 parent 69a8bf0 commit 375b379
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions localstack/utils/aws/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
from localstack.utils.sync import poll_condition


def create_sqs_queue(queue_name):
return connect_to().sqs.create_queue(QueueName=queue_name)


# TODO: make s3_client mandatory
def get_or_create_bucket(bucket_name: str, s3_client=None):
s3_client = s3_client or connect_to().s3
Expand Down
8 changes: 4 additions & 4 deletions tests/aws/services/apigateway/test_apigateway_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from localstack.services.apigateway.helpers import connect_api_gateway_to_sqs, path_based_url
from localstack.testing.pytest import markers
from localstack.utils.aws import queries
from localstack.utils.aws import resources as resource_util
from localstack.utils.strings import short_uid, to_str
from localstack.utils.sync import retry
from localstack.utils.xml import is_valid_xml
Expand All @@ -18,10 +17,10 @@


@markers.aws.unknown
def test_api_gateway_sqs_integration(aws_client):
def test_api_gateway_sqs_integration(aws_client, sqs_create_queue, sqs_get_queue_arn):
# create target SQS stream
queue_name = f"queue-{short_uid()}"
resource_util.create_sqs_queue(queue_name)
sqs_create_queue(QueueName=queue_name)

# create API Gateway and connect it to the target queue
result = connect_api_gateway_to_sqs(
Expand All @@ -44,7 +43,8 @@ def test_api_gateway_sqs_integration(aws_client):
result = requests.post(url, data=json.dumps(test_data))
assert 200 == result.status_code

messages = queries.sqs_receive_message(queue_name)["Messages"]
queue_arn = sqs_get_queue_arn(queue_name)
messages = queries.sqs_receive_message(queue_arn)["Messages"]
assert 1 == len(messages)
assert test_data == json.loads(base64.b64decode(messages[0]["Body"]))

Expand Down

0 comments on commit 375b379

Please sign in to comment.