Skip to content

Commit 0220e89

Browse files
committed
Make the tests more explicit
1 parent f3f1455 commit 0220e89

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

tests/slack_bolt/authorization/test_authorize.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_installation_store_cached_legacy(self):
7777
assert self.mock_received_requests["/auth.test"] == 1 # cached
7878

7979
def test_installation_store_bot_only(self):
80-
installation_store = MemoryInstallationStore()
80+
installation_store = BotOnlyMemoryInstallationStore()
8181
authorize = InstallationStoreAuthorize(
8282
logger=installation_store.logger,
8383
installation_store=installation_store,
@@ -105,7 +105,7 @@ def test_installation_store_bot_only(self):
105105
assert self.mock_received_requests["/auth.test"] == 2
106106

107107
def test_installation_store_cached_bot_only(self):
108-
installation_store = MemoryInstallationStore()
108+
installation_store = BotOnlyMemoryInstallationStore()
109109
authorize = InstallationStoreAuthorize(
110110
logger=installation_store.logger,
111111
installation_store=installation_store,
@@ -233,3 +233,15 @@ def find_installation(
233233
user_scopes=["search:read"],
234234
installed_at=datetime.datetime.now().timestamp(),
235235
)
236+
237+
238+
class BotOnlyMemoryInstallationStore(LegacyMemoryInstallationStore):
239+
def find_installation(
240+
self,
241+
*,
242+
enterprise_id: Optional[str],
243+
team_id: Optional[str],
244+
user_id: Optional[str] = None,
245+
is_enterprise_install: Optional[bool] = False,
246+
) -> Optional[Installation]:
247+
raise ValueError

tests/slack_bolt_async/authorization/test_async_authorize.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async def test_installation_store_cached_legacy(self):
9292

9393
@pytest.mark.asyncio
9494
async def test_installation_store_bot_only(self):
95-
installation_store = MemoryInstallationStore()
95+
installation_store = BotOnlyMemoryInstallationStore()
9696
authorize = AsyncInstallationStoreAuthorize(
9797
logger=installation_store.logger,
9898
installation_store=installation_store,
@@ -121,7 +121,7 @@ async def test_installation_store_bot_only(self):
121121

122122
@pytest.mark.asyncio
123123
async def test_installation_store_cached_bot_only(self):
124-
installation_store = MemoryInstallationStore()
124+
installation_store = BotOnlyMemoryInstallationStore()
125125
authorize = AsyncInstallationStoreAuthorize(
126126
logger=installation_store.logger,
127127
installation_store=installation_store,
@@ -253,3 +253,15 @@ async def async_find_installation(
253253
user_scopes=["search:read"],
254254
installed_at=datetime.datetime.now().timestamp(),
255255
)
256+
257+
258+
class BotOnlyMemoryInstallationStore(LegacyMemoryInstallationStore):
259+
async def async_find_installation(
260+
self,
261+
*,
262+
enterprise_id: Optional[str],
263+
team_id: Optional[str],
264+
user_id: Optional[str] = None,
265+
is_enterprise_install: Optional[bool] = False,
266+
) -> Optional[Installation]:
267+
raise ValueError

0 commit comments

Comments
 (0)