From e5b1832ff798b7e919ad9dd72f29d8f82415ce63 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Fri, 20 Nov 2026 12:25:19 -0500 Subject: [PATCH] test(oauth): drop indexes so the sqlite3 same-second tie test covers every lookup A reverse scan of slack_bots_idx or slack_installations_idx already breaks an installed_at tie by rowid, so the test stayed green without the id tie-break in find_bot or the user_id lookup. The test now uses its own temporary database and drops both indexes, so every lookup has to sort. Co-Authored-By: Claude --- .../oauth/installation_store/test_sqlite3.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/slack_sdk/oauth/installation_store/test_sqlite3.py b/tests/slack_sdk/oauth/installation_store/test_sqlite3.py index ab0bb3b5a..371a953ae 100644 --- a/tests/slack_sdk/oauth/installation_store/test_sqlite3.py +++ b/tests/slack_sdk/oauth/installation_store/test_sqlite3.py @@ -1,3 +1,4 @@ +import tempfile import unittest from slack_sdk.oauth.installation_store import Installation @@ -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( @@ -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") bot = store.find_bot(enterprise_id="E333", team_id="T333") self.assertEqual(bot.bot_token, "xoxb-new") @@ -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")