Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update moto requirement from <5,>=3 to >=3,<6 #1046

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/adapter_testing.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pip install -r requirements/adapter_testing.txt
moto>=3,<5 # For AWS tests
moto>=3,<6 # For AWS tests
docker>=5,<6 # Used by moto
boddle>=0.2,<0.3 # For Bottle app tests
sanic-testing>=0.7; python_version>"3.6"
21 changes: 12 additions & 9 deletions tests/adapter_tests/aws/test_aws_lambda.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import json
from time import time
from urllib.parse import quote

from moto import mock_lambda
from slack_sdk.signature import SignatureVerifier
from slack_sdk.web import WebClient
from slack_sdk.oauth import OAuthStateStore
Expand All @@ -20,6 +18,11 @@
)
from tests.utils import remove_os_env_temporarily, restore_os_env

try:
from moto import mock_aws
except ImportError:
from moto import mock_lambda as mock_aws


class LambdaContext:
function_name: str
Expand Down Expand Up @@ -72,7 +75,7 @@ def test_first_value(self):
assert _first_value({"foo": []}, "foo") is None
assert _first_value({}, "foo") is None

@mock_lambda
@mock_aws
def test_clear_all_log_handlers(self):
app = App(
client=self.web_client,
Expand All @@ -81,7 +84,7 @@ def test_clear_all_log_handlers(self):
handler = SlackRequestHandler(app)
handler.clear_all_log_handlers()

@mock_lambda
@mock_aws
def test_events(self):
app = App(
client=self.web_client,
Expand Down Expand Up @@ -136,7 +139,7 @@ def event_handler():
assert response["statusCode"] == 200
assert_auth_test_count(self, 1)

@mock_lambda
@mock_aws
def test_shortcuts(self):
app = App(
client=self.web_client,
Expand Down Expand Up @@ -186,7 +189,7 @@ def shortcut_handler(ack):
assert response["statusCode"] == 200
assert_auth_test_count(self, 1)

@mock_lambda
@mock_aws
def test_commands(self):
app = App(
client=self.web_client,
Expand Down Expand Up @@ -236,7 +239,7 @@ def command_handler(ack):
assert response["statusCode"] == 200
assert_auth_test_count(self, 1)

@mock_lambda
@mock_aws
def test_lazy_listeners(self):
app = App(
client=self.web_client,
Expand Down Expand Up @@ -282,7 +285,7 @@ def say_it(say):
assert_auth_test_count(self, 1)
assert_received_request_count(self, "/chat.postMessage", 1)

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

@mock_lambda
@mock_aws
def test_oauth_redirect(self):
class TestStateStore(OAuthStateStore):
def consume(self, state: str) -> bool:
Expand Down
9 changes: 6 additions & 3 deletions tests/adapter_tests/aws/test_lambda_s3_oauth_flow.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from moto import mock_s3

from slack_bolt.adapter.aws_lambda.lambda_s3_oauth_flow import LambdaS3OAuthFlow
from slack_bolt.oauth.oauth_settings import OAuthSettings
from tests.utils import remove_os_env_temporarily, restore_os_env

try:
from moto import mock_aws
except ImportError:
from moto import mock_s3 as mock_aws


class TestLambdaS3OAuthFlow:
def setup_method(self):
Expand All @@ -12,7 +15,7 @@ def setup_method(self):
def teardown_method(self):
restore_os_env(self.old_os_env)

@mock_s3
@mock_aws
def test_instantiation(self):
oauth_flow = LambdaS3OAuthFlow(
settings=OAuthSettings(
Expand Down
Loading