Skip to content

Commit

Permalink
fix moto mock
Browse files Browse the repository at this point in the history
  • Loading branch information
Emma Ai committed Feb 21, 2024
1 parent 9592a3c commit 2ed3954
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions apps/dc_tools/tests/test_sns_publishing.py
Expand Up @@ -3,7 +3,7 @@
import os
import pytest
from click.testing import CliRunner
from moto import mock_sns, mock_sqs
from moto import mock_aws
from pathlib import Path

from odc.apps.dc_tools.fs_to_dc import cli as fs_cli
Expand All @@ -27,7 +27,7 @@ def sns_setup(aws_credentials, aws_env):
Tests are structured as follows:
input: [ STAC -> SNS -> SQS ] -> dc_tools -> output: [ STAC -> SNS -> SQS ]
"""
with mock_sqs(), mock_sns():
with mock_aws():
sns = boto3.client("sns")
sqs = boto3.client("sqs")

Expand Down
4 changes: 2 additions & 2 deletions apps/dc_tools/tests/test_sqs_to_dc.py
Expand Up @@ -8,7 +8,7 @@
import pytest
from deepdiff import DeepDiff
from functools import partial
from moto import mock_sqs
from moto import mock_aws
from odc.aws.queue import get_messages
from pathlib import Path
from pprint import pformat
Expand Down Expand Up @@ -98,7 +98,7 @@ def aws_credentials():
os.environ["AWS_SESSION_TOKEN"] = "testing"


@mock_sqs
@mock_aws
def test_extract_metadata_from_message(aws_credentials, odc_test_db_with_products):
TEST_QUEUE_NAME = "a_test_queue"
sqs_resource = boto3.resource("sqs")
Expand Down
10 changes: 5 additions & 5 deletions libs/cloud/tests/test_aws.py
Expand Up @@ -3,7 +3,7 @@
import os
import pytest
from click.testing import CliRunner
from moto import mock_sqs
from moto import mock_aws
from odc.aws._find import parse_query
from odc.aws.queue import get_queue, get_queues, redrive_queue
from types import SimpleNamespace
Expand All @@ -24,7 +24,7 @@ def aws_env(monkeypatch):
monkeypatch.setenv("AWS_DEFAULT_REGION", "us-west-2")


@mock_sqs
@mock_aws
def test_redrive_to_queue(aws_env):
resource = boto3.resource("sqs")

Expand Down Expand Up @@ -66,7 +66,7 @@ def test_redrive_to_queue(aws_env):
assert get_n_messages(dead_queue) == 0


@mock_sqs
@mock_aws
def test_redrive_to_queue_cli(aws_env):
resource = boto3.resource("sqs")

Expand Down Expand Up @@ -127,7 +127,7 @@ def test_redrive_to_queue_cli(aws_env):
)


@mock_sqs
@mock_aws
def test_get_queues(aws_env):
resource = boto3.resource("sqs")

Expand Down Expand Up @@ -169,7 +169,7 @@ def test_get_queues(aws_env):
assert len(list(queues)) == 0


@mock_sqs
@mock_aws
def test_get_queues_empty(aws_env):
queues = get_queues()

Expand Down

0 comments on commit 2ed3954

Please sign in to comment.