From ec9184d11c639a0544c48f0175dcba41ef12da06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 10:45:41 +0000 Subject: [PATCH 1/2] chore(deps-dev): bump moto from 4.2.13 to 5.0.25 Bumps [moto](https://github.com/getmoto/moto) from 4.2.13 to 5.0.25. - [Release notes](https://github.com/getmoto/moto/releases) - [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md) - [Commits](https://github.com/getmoto/moto/compare/4.2.13...5.0.25) --- updated-dependencies: - dependency-name: moto dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements/requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index cb116e4f..1cc412c7 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -1,2 +1,2 @@ -moto==4.2.13 +moto==5.0.25 -r ./requirements_common.txt From 4d59b11d967467ea15c07336e8068c5c276df5cf Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Tue, 31 Dec 2024 08:51:58 -0800 Subject: [PATCH 2/2] Updates test for moto v5 --- lambda/tests/test_new_account_iam_role.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lambda/tests/test_new_account_iam_role.py b/lambda/tests/test_new_account_iam_role.py index 73defccf..f1b0dfc2 100644 --- a/lambda/tests/test_new_account_iam_role.py +++ b/lambda/tests/test_new_account_iam_role.py @@ -16,9 +16,7 @@ import boto3 import botocore.exceptions import pytest -from moto import mock_iam -from moto import mock_sts -from moto import mock_organizations +from moto import mock_aws from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID import new_account_iam_role as lambda_func @@ -53,7 +51,7 @@ def aws_credentials(tmpdir, monkeypatch): In addition to using the aws_credentials fixture, the test functions must also use a mocked client. For this test file, that would be the - test fixture "iam_client", which invokes "mock_iam()" or "sts_client". + test fixture "iam_client", which invokes "mock_aws()" or "sts_client". """ # Create a temporary AWS credentials file for calls to boto.Session(). aws_creds = [ @@ -77,21 +75,21 @@ def aws_credentials(tmpdir, monkeypatch): @pytest.fixture(scope="function") def iam_client(aws_credentials): """Yield a mock IAM client that will not affect a real AWS account.""" - with mock_iam(): + with mock_aws(config={"iam": {"load_aws_managed_policies": True}}): yield boto3.client("iam", region_name=AWS_REGION) @pytest.fixture(scope="function") def sts_client(aws_credentials): """Yield a mock STS client that will not affect a real AWS account.""" - with mock_sts(): + with mock_aws(config={"iam": {"load_aws_managed_policies": True}}): yield boto3.client("sts", region_name=AWS_REGION) @pytest.fixture(scope="function") def org_client(aws_credentials): """Yield a mock organization that will not affect a real AWS account.""" - with mock_organizations(): + with mock_aws(config={"iam": {"load_aws_managed_policies": True}}): yield boto3.client("organizations", region_name=AWS_REGION)