Skip to content

Commit b041c02

Browse files
WilliamBergaminClaude
andauthored
fix(oauth): delete org-wide installations in the sqlite3 store (#2062)
Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
1 parent c3bd3d2 commit b041c02

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

‎slack_sdk/oauth/installation_store/sqlite3/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ def delete_installation(
583583
and
584584
team_id = ?
585585
""",
586-
[self.client_id, enterprise_id or "", team_id],
586+
[self.client_id, enterprise_id or "", team_id or ""],
587587
)
588588
else:
589589
conn.execute(
@@ -600,7 +600,7 @@ def delete_installation(
600600
and
601601
user_id = ?
602602
""",
603-
[self.client_id, enterprise_id or "", team_id, user_id],
603+
[self.client_id, enterprise_id or "", team_id or "", user_id],
604604
)
605605
conn.commit()
606606
except Exception as e:

‎tests/slack_sdk/oauth/installation_store/test_sqlite3.py‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,24 @@ def test_org_installation(self):
138138
self.assertIsNone(i)
139139

140140
# delete installations
141-
store.delete_installation(enterprise_id="E111", team_id=None)
142-
i = store.find_installation(enterprise_id="E111", team_id=None)
141+
store.delete_installation(enterprise_id="EO111", team_id=None, user_id="UO111")
142+
i = store.find_installation(enterprise_id="EO111", team_id=None, user_id="UO111")
143+
self.assertIsNone(i)
144+
145+
store.save(installation)
146+
store.delete_installation(enterprise_id="EO111", team_id=None)
147+
i = store.find_installation(enterprise_id="EO111", team_id=None)
143148
self.assertIsNone(i)
144149

145150
# delete all
146151
store.save(installation)
147-
store.delete_all(enterprise_id="E111", team_id=None)
152+
store.delete_all(enterprise_id="EO111", team_id=None)
148153

149-
i = store.find_installation(enterprise_id="E111", team_id=None)
154+
i = store.find_installation(enterprise_id="EO111", team_id=None)
150155
self.assertIsNone(i)
151-
i = store.find_installation(enterprise_id="E111", team_id=None, user_id="U111")
156+
i = store.find_installation(enterprise_id="EO111", team_id=None, user_id="UO111")
152157
self.assertIsNone(i)
153-
bot = store.find_bot(enterprise_id=None, team_id="T222")
158+
bot = store.find_bot(enterprise_id="EO111", team_id=None)
154159
self.assertIsNone(bot)
155160

156161
def test_save_and_find_token_rotation(self):

0 commit comments

Comments
 (0)