Skip to content
3 changes: 2 additions & 1 deletion tests/adapter_tests/django/test_django_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "logs/db.sqlite3",
"NAME": ":memory:",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👁️‍🗨️ question: Does this sqlite implementation not use the file system? I haven't explored these tests much but found this surprising at glance!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point I found another way to silence the django warning 🙏

}
}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# Django 4 warning: The default value of USE_TZ will change from False to True in Django 5.0.
# Set USE_TZ to False in your project settings if you want to keep the current default behavior.
USE_TZ = False
8 changes: 4 additions & 4 deletions tests/adapter_tests/starlette/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -138,7 +138,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -182,7 +182,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -254,7 +254,7 @@ async def endpoint(req: Request, foo: str = Depends(get_foo)):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down
6 changes: 3 additions & 3 deletions tests/adapter_tests/starlette/test_starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -143,7 +143,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -189,7 +189,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down
8 changes: 4 additions & 4 deletions tests/adapter_tests_async/test_async_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -138,7 +138,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -182,7 +182,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -255,7 +255,7 @@ async def endpoint(req: Request, foo: str = Depends(get_foo)):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down
6 changes: 3 additions & 3 deletions tests/adapter_tests_async/test_async_starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -143,7 +143,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down Expand Up @@ -189,7 +189,7 @@ async def endpoint(req: Request):
client = TestClient(api)
response = client.post(
"/slack/events",
data=body,
content=body,
headers=self.build_headers(timestamp, body),
)
assert response.status_code == 200
Expand Down
10 changes: 5 additions & 5 deletions tests/scenario_tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import time
from concurrent.futures import Executor
from ssl import SSLContext
import ssl

import pytest
from slack_sdk import WebClient
Expand Down Expand Up @@ -236,12 +236,12 @@ def test_none_body_no_middleware(self):
assert response.body == '{"error": "unhandled request"}'

def test_proxy_ssl_for_respond(self):
ssl = SSLContext()
ssl_context = ssl.create_default_context()
web_client = WebClient(
token=self.valid_token,
base_url=self.mock_api_server_base_url,
proxy="http://proxy-host:9000/",
ssl=ssl,
ssl=ssl_context,
)
app = App(
signing_secret="valid",
Expand All @@ -257,9 +257,9 @@ def test_proxy_ssl_for_respond(self):
@app.event("app_mention")
def handle(context: BoltContext, respond):
assert context.respond.proxy == "http://proxy-host:9000/"
assert context.respond.ssl == ssl
assert context.respond.ssl == ssl_context
assert respond.proxy == "http://proxy-host:9000/"
assert respond.ssl == ssl
assert respond.ssl == ssl_context
result["called"] = True

req = BoltRequest(body=app_mention_event_body, headers={}, mode="socket_mode")
Expand Down
4 changes: 2 additions & 2 deletions tests/scenario_tests/test_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ def async2(context, say):

@app.middleware
def set_ssl_context(context, next_):
from ssl import SSLContext
import ssl

context["foo"] = "FOO"
# This causes an error when starting lazy listener executions
context["ssl_context"] = SSLContext()
context["ssl_context"] = ssl.create_default_context()
next_()

# 2021-12-13 11:14:29 ERROR Failed to run a middleware middleware (error: cannot pickle 'SSLContext' object)
Expand Down
10 changes: 5 additions & 5 deletions tests/scenario_tests_async/test_app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
import logging
from ssl import SSLContext
import ssl

import pytest
from slack_sdk import WebClient
Expand Down Expand Up @@ -185,14 +185,14 @@ def test_installation_store_conflicts(self):

@pytest.mark.asyncio
async def test_proxy_ssl_for_respond(self):
ssl = SSLContext()
ssl_ctx = ssl.create_default_context()
app = AsyncApp(
signing_secret="valid",
client=AsyncWebClient(
token=self.valid_token,
base_url=self.mock_api_server_base_url,
proxy="http://proxy-host:9000/",
ssl=ssl,
ssl=ssl_ctx,
),
authorize=my_authorize,
)
Expand All @@ -202,9 +202,9 @@ async def test_proxy_ssl_for_respond(self):
@app.event("app_mention")
async def handle(context: AsyncBoltContext, respond):
assert context.respond.proxy == "http://proxy-host:9000/"
assert context.respond.ssl == ssl
assert context.respond.ssl == ssl_ctx
assert respond.proxy == "http://proxy-host:9000/"
assert respond.ssl == ssl
assert respond.ssl == ssl_ctx
result["called"] = True

req = AsyncBoltRequest(body=app_mention_event_body, headers={}, mode="socket_mode")
Expand Down
4 changes: 2 additions & 2 deletions tests/scenario_tests_async/test_lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ async def async2(context, say):

@app.middleware
async def set_ssl_context(context, next_):
from ssl import SSLContext
import ssl

context["foo"] = "FOO"
# This causes an error when starting lazy listener executions
context["ssl_context"] = SSLContext()
context["ssl_context"] = ssl.create_default_context()
await next_()

# 2021-12-13 11:52:46 ERROR Failed to run a middleware function (error: cannot pickle 'SSLContext' object)
Expand Down
Loading