diff --git a/requirements/testing.txt b/requirements/testing.txt index 0a4d7ae9f..82337fe14 100644 --- a/requirements/testing.txt +++ b/requirements/testing.txt @@ -14,4 +14,7 @@ click==8.0.4 # black is affected by https://github.com/pallets/click/issues/222 psutil>=5,<6 # used only under slack_sdk/*_store boto3<=2 -moto>=3,<4 # For AWS tests +# For AWS tests +moto==4.0.13; python_version=="3.6" +moto<5; python_version=="3.7" +moto<6 diff --git a/tests/slack_sdk/oauth/installation_store/test_amazon_s3.py b/tests/slack_sdk/oauth/installation_store/test_amazon_s3.py index ab4b25fb4..a51f37e9d 100644 --- a/tests/slack_sdk/oauth/installation_store/test_amazon_s3.py +++ b/tests/slack_sdk/oauth/installation_store/test_amazon_s3.py @@ -1,23 +1,27 @@ import unittest import boto3 -from moto import mock_s3 + +try: + from moto import mock_aws +except ImportError: + from moto import mock_s3 as mock_aws from slack_sdk.oauth.installation_store import Installation from slack_sdk.oauth.installation_store.amazon_s3 import AmazonS3InstallationStore class TestAmazonS3(unittest.TestCase): - mock_s3 = mock_s3() + mock_aws = mock_aws() bucket_name = "test-bucket" def setUp(self): - self.mock_s3.start() + self.mock_aws.start() s3 = boto3.resource("s3") bucket = s3.Bucket(self.bucket_name) bucket.create(CreateBucketConfiguration={"LocationConstraint": "af-south-1"}) def tearDown(self): - self.mock_s3.stop() + self.mock_aws.stop() def build_store(self) -> AmazonS3InstallationStore: return AmazonS3InstallationStore( diff --git a/tests/slack_sdk/oauth/state_store/test_amazon_s3.py b/tests/slack_sdk/oauth/state_store/test_amazon_s3.py index 8561eeb62..277b8b83a 100644 --- a/tests/slack_sdk/oauth/state_store/test_amazon_s3.py +++ b/tests/slack_sdk/oauth/state_store/test_amazon_s3.py @@ -1,22 +1,26 @@ import unittest import boto3 -from moto import mock_s3 + +try: + from moto import mock_aws +except ImportError: + from moto import mock_s3 as mock_aws from slack_sdk.oauth.state_store.amazon_s3 import AmazonS3OAuthStateStore class TestAmazonS3(unittest.TestCase): - mock_s3 = mock_s3() + mock_aws = mock_aws() bucket_name = "test-bucket" def setUp(self): - self.mock_s3.start() + self.mock_aws.start() s3 = boto3.resource("s3") bucket = s3.Bucket(self.bucket_name) bucket.create(CreateBucketConfiguration={"LocationConstraint": "af-south-1"}) def tearDown(self): - self.mock_s3.stop() + self.mock_aws.stop() def test_instance(self): store = AmazonS3OAuthStateStore(