async def test_success_without_type(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) app.options("dialog-callback-id")(handle_suggestion) app.action("dialog-callback-id")(handle_submission_or_cancellation) request = self.build_valid_request(suggestion_raw_body) response = await app.async_dispatch(request) assert response.status == 200 assert response.body != "" assert response.headers["content-type"][ 0] == "application/json;charset=utf-8" await assert_auth_test_count_async(self, 1) request = self.build_valid_request(submission_raw_body) response = await app.async_dispatch(request) assert response.status == 200 assert response.body == "" await assert_auth_test_count_async(self, 1) request = self.build_valid_request(cancellation_raw_body) response = await app.async_dispatch(request) assert response.status == 200 assert response.body == "" await assert_auth_test_count_async(self, 1)
async def test_success(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) app.options("es_a")(show_options) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 assert response.body == expected_response_body assert response.headers["content-type"][ 0] == "application/json;charset=utf-8" assert self.mock_received_requests["/auth.test"] == 1
async def test_suggestion_failure_without_type(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_request(suggestion_raw_body) response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1) app.options("dialog-callback-iddddd")(handle_suggestion) response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1)
async def test_failure_multi(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_multi_request() response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1 app.options("es_a")(show_options) response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1
async def test_failure_multi(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_multi_request() response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1) app.options("es_a")(show_options) response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1)
async def test_success_multi(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) app.options("mes_a")(show_multi_options) request = self.build_valid_multi_request() response = await app.async_dispatch(request) assert response.status == 200 assert response.body == expected_multi_response_body assert response.headers["content-type"][ 0] == "application/json;charset=utf-8" await assert_auth_test_count_async(self, 1)
async def test_suggestion_failure_2(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_request(suggestion_raw_body) response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1 app.options({ "type": "dialog_suggestion", "callback_id": "dialog-callback-iddddd" })(handle_suggestion) response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 2
async def test_process_before_response(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, process_before_response=True, ) app.options({ "type": "dialog_suggestion", "callback_id": "dialog-callback-id" })(handle_suggestion) app.action({ "type": "dialog_submission", "callback_id": "dialog-callback-id" })(handle_submission) app.action({ "type": "dialog_cancellation", "callback_id": "dialog-callback-id" })(handle_cancellation) request = self.build_valid_request(suggestion_raw_body) response = await app.async_dispatch(request) assert response.status == 200 assert response.body != "" assert response.headers["content-type"][ 0] == "application/json;charset=utf-8" assert self.mock_received_requests["/auth.test"] == 1 request = self.build_valid_request(submission_raw_body) response = await app.async_dispatch(request) assert response.status == 200 assert response.body == "" assert self.mock_received_requests["/auth.test"] == 2 request = self.build_valid_request(cancellation_raw_body) response = await app.async_dispatch(request) assert response.status == 200 assert response.body == "" assert self.mock_received_requests["/auth.test"] == 3