Skip to content

Commit b5e5439

Browse files
Update moto requirement from <5,>=3 to >=3,<6 (#1046)
* Update moto requirement from <5,>=3 to >=3,<6 Updates the requirements on [moto](https://github.com/getmoto/moto) to permit the latest version. - [Release notes](https://github.com/getmoto/moto/releases) - [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md) - [Commits](getmoto/moto@3.0.0...5.0.2) --- updated-dependencies: - dependency-name: moto dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Fix imports for moto This change allows the import to use the old and new version of the dependency --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: William Bergamin <[email protected]>
1 parent 996f29f commit b5e5439

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

requirements/adapter_testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pip install -r requirements/adapter_testing.txt
2-
moto>=3,<5 # For AWS tests
2+
moto>=3,<6 # For AWS tests
33
docker>=5,<6 # Used by moto
44
boddle>=0.2,<0.3 # For Bottle app tests
55
sanic-testing>=0.7; python_version>"3.6"

tests/adapter_tests/aws/test_aws_lambda.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import json
22
from time import time
33
from urllib.parse import quote
4-
5-
from moto import mock_lambda
64
from slack_sdk.signature import SignatureVerifier
75
from slack_sdk.web import WebClient
86
from slack_sdk.oauth import OAuthStateStore
@@ -20,6 +18,11 @@
2018
)
2119
from tests.utils import remove_os_env_temporarily, restore_os_env
2220

21+
try:
22+
from moto import mock_aws
23+
except ImportError:
24+
from moto import mock_lambda as mock_aws
25+
2326

2427
class LambdaContext:
2528
function_name: str
@@ -72,7 +75,7 @@ def test_first_value(self):
7275
assert _first_value({"foo": []}, "foo") is None
7376
assert _first_value({}, "foo") is None
7477

75-
@mock_lambda
78+
@mock_aws
7679
def test_clear_all_log_handlers(self):
7780
app = App(
7881
client=self.web_client,
@@ -81,7 +84,7 @@ def test_clear_all_log_handlers(self):
8184
handler = SlackRequestHandler(app)
8285
handler.clear_all_log_handlers()
8386

84-
@mock_lambda
87+
@mock_aws
8588
def test_events(self):
8689
app = App(
8790
client=self.web_client,
@@ -136,7 +139,7 @@ def event_handler():
136139
assert response["statusCode"] == 200
137140
assert_auth_test_count(self, 1)
138141

139-
@mock_lambda
142+
@mock_aws
140143
def test_shortcuts(self):
141144
app = App(
142145
client=self.web_client,
@@ -186,7 +189,7 @@ def shortcut_handler(ack):
186189
assert response["statusCode"] == 200
187190
assert_auth_test_count(self, 1)
188191

189-
@mock_lambda
192+
@mock_aws
190193
def test_commands(self):
191194
app = App(
192195
client=self.web_client,
@@ -236,7 +239,7 @@ def command_handler(ack):
236239
assert response["statusCode"] == 200
237240
assert_auth_test_count(self, 1)
238241

239-
@mock_lambda
242+
@mock_aws
240243
def test_lazy_listeners(self):
241244
app = App(
242245
client=self.web_client,
@@ -282,7 +285,7 @@ def say_it(say):
282285
assert_auth_test_count(self, 1)
283286
assert_received_request_count(self, "/chat.postMessage", 1)
284287

285-
@mock_lambda
288+
@mock_aws
286289
def test_oauth(self):
287290
app = App(
288291
client=self.web_client,
@@ -318,7 +321,7 @@ def test_oauth(self):
318321
assert response["headers"]["content-type"] == "text/html; charset=utf-8"
319322
assert "https://slack.com/oauth/v2/authorize?state=" in response.get("body")
320323

321-
@mock_lambda
324+
@mock_aws
322325
def test_oauth_redirect(self):
323326
class TestStateStore(OAuthStateStore):
324327
def consume(self, state: str) -> bool:

tests/adapter_tests/aws/test_lambda_s3_oauth_flow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
from moto import mock_s3
2-
31
from slack_bolt.adapter.aws_lambda.lambda_s3_oauth_flow import LambdaS3OAuthFlow
42
from slack_bolt.oauth.oauth_settings import OAuthSettings
53
from tests.utils import remove_os_env_temporarily, restore_os_env
64

5+
try:
6+
from moto import mock_aws
7+
except ImportError:
8+
from moto import mock_s3 as mock_aws
9+
710

811
class TestLambdaS3OAuthFlow:
912
def setup_method(self):
@@ -12,7 +15,7 @@ def setup_method(self):
1215
def teardown_method(self):
1316
restore_os_env(self.old_os_env)
1417

15-
@mock_s3
18+
@mock_aws
1619
def test_instantiation(self):
1720
oauth_flow = LambdaS3OAuthFlow(
1821
settings=OAuthSettings(

0 commit comments

Comments
 (0)