Skip to content

Commit 2216935

Browse files
committed
Update tests for Sanic adapter
1 parent 4660bbc commit 2216935

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/adapter_tests_async/test_async_sanic.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class TestSanic:
2929
base_url=mock_api_server_base_url,
3030
)
3131

32+
@staticmethod
33+
def unique_sanic_app_name() -> str:
34+
return f"awesome-slack-app-{time()}"
35+
3236
@pytest.fixture
3337
def event_loop(self):
3438
old_os_env = remove_os_env_temporarily()
@@ -93,7 +97,7 @@ async def event_handler():
9397
}
9498
timestamp, body = str(int(time())), json.dumps(input)
9599

96-
api = Sanic(name="awesome-slack-app")
100+
api = Sanic(name=self.unique_sanic_app_name())
97101
app_handler = AsyncSlackRequestHandler(app)
98102

99103
@api.post("/slack/events")
@@ -137,7 +141,7 @@ async def shortcut_handler(ack):
137141

138142
timestamp, body = str(int(time())), f"payload={quote(json.dumps(input))}"
139143

140-
api = Sanic(name="awesome-slack-app")
144+
api = Sanic(name=self.unique_sanic_app_name())
141145
app_handler = AsyncSlackRequestHandler(app)
142146

143147
@api.post("/slack/events")
@@ -181,7 +185,7 @@ async def command_handler(ack):
181185
)
182186
timestamp, body = str(int(time())), input
183187

184-
api = Sanic(name="awesome-slack-app")
188+
api = Sanic(name=self.unique_sanic_app_name())
185189
app_handler = AsyncSlackRequestHandler(app)
186190

187191
@api.post("/slack/events")
@@ -207,7 +211,7 @@ async def test_oauth(self):
207211
scopes=["chat:write", "commands"],
208212
),
209213
)
210-
api = Sanic(name="awesome-slack-app")
214+
api = Sanic(name=self.unique_sanic_app_name())
211215
app_handler = AsyncSlackRequestHandler(app)
212216

213217
@api.get("/slack/install")

0 commit comments

Comments
 (0)