Skip to content
Merged
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
11 changes: 6 additions & 5 deletions tests/slack_sdk/oauth/installation_store/test_sqlite3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import tempfile
import unittest

from slack_sdk.oauth.installation_store import Installation
Expand Down Expand Up @@ -332,8 +333,9 @@ def test_issue_1441_mixing_user_and_bot_installations(self):
self.assertIsNone(installation)

def test_find_returns_latest_save_within_the_same_second(self):
store = SQLite3InstallationStore(database="logs/test.db", client_id="111.222")
store.delete_all(enterprise_id="E333", team_id="T333")
directory = tempfile.TemporaryDirectory()
self.addCleanup(directory.cleanup)
store = SQLite3InstallationStore(database=f"{directory.name}/test.db", client_id="111.222")

for suffix in ["old", "new"]:
store.save(
Expand All @@ -360,7 +362,8 @@ def test_find_returns_latest_save_within_the_same_second(self):
)
with store.connect() as conn:
for table in ["slack_installations", "slack_bots"]:
conn.execute(f"update {table} set installed_at = '2026-11-19 10:00:00' where enterprise_id = 'E333'")
conn.execute(f"update {table} set installed_at = '2026-11-19 10:00:00'")
conn.execute(f"drop index {table}_idx")

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.

suggestion (non-blocking): A one-line comment on why the indexes are dropped would help here. Without it, this reads like leftover setup and someone could remove it, and the test would stay green while losing the find_bot and user_id coverage again.


bot = store.find_bot(enterprise_id="E333", team_id="T333")
self.assertEqual(bot.bot_token, "xoxb-new")
Expand All @@ -372,5 +375,3 @@ def test_find_returns_latest_save_within_the_same_second(self):
installation = store.find_installation(enterprise_id="E333", team_id="T333", user_id="U333")
self.assertEqual(installation.user_token, "xoxp-new")
self.assertEqual(installation.bot_token, "xoxb-new")

store.delete_all(enterprise_id="E333", team_id="T333")
Loading