File support-moto-5.patch of Package python-environ-config
From 2c51eda55d152d4bd59f51a033c5976bfe05a897 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Tue, 13 Feb 2024 15:53:34 +1100
Subject: [PATCH 1/2] Support moto 5.0
moto 5.0 has been released, and the major change is to pull all of the
mocking into one function. Use the new mock_aws function, but continue
to support moto 4.2, since it's easy.
---
pyproject.toml | 2 +-
tests/test_secrets_awssm.py | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/test_secrets_awssm.py b/tests/test_secrets_awssm.py
index db999d1..90b863c 100644
--- a/tests/test_secrets_awssm.py
+++ b/tests/test_secrets_awssm.py
@@ -23,7 +23,10 @@
import boto3
import pytest
-from moto import mock_secretsmanager
+try:
+ from moto import mock_aws
+except ImportError:
+ from moto import mock_secretsmanager as mock_aws
import environ
@@ -62,7 +65,7 @@ def _mock_aws_credentials(force_region):
@pytest.fixture(name="secretsmanager")
def _secretsmanager():
- with mock_secretsmanager():
+ with mock_aws():
yield boto3.client("secretsmanager", region_name="us-east-2")
@@ -122,7 +125,7 @@ def test_secret_works_with_default_client_overridden(
class Cfg:
pw = sm.secret()
- with mock_secretsmanager():
+ with mock_aws():
# we need to make sure we're using the same region. It doesn't
# matter which -- moto _and_ boto will try figure it out from the
# environment -- but it has to be the same.
From 40a01bee6579d9265e731b9f12e6a890f68bf0c5 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 13 Feb 2024 04:56:33 +0000
Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---
tests/test_secrets_awssm.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/test_secrets_awssm.py b/tests/test_secrets_awssm.py
index 90b863c..b109eb3 100644
--- a/tests/test_secrets_awssm.py
+++ b/tests/test_secrets_awssm.py
@@ -23,6 +23,7 @@
import boto3
import pytest
+
try:
from moto import mock_aws
except ImportError: