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.action("a")(simple_listener) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 assert self.mock_received_requests["/auth.test"] == 1
async def test_success(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) app.action("a")(simple_listener) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 await assert_auth_test_count_async(self, 1)
async def test_default_type_unmatched_block_id(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) app.action({"action_id": "a", "block_id": "bbb"})(simple_listener) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1)
async def test_default_type(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) app.action({"action_id": "a", "block_id": "b"})(simple_listener) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 assert self.mock_received_requests["/auth.test"] == 1
async def test_bot_context_attributes(self): app = AsyncApp( client=self.web_client, authorize=authorize, signing_secret=self.signing_secret, ) app.action("a")(assert_bot_context_attributes) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 assert response.body == "" assert self.mock_received_requests["/auth.test"] == 1
async def test_user_context_attributes(self): app = AsyncApp( client=self.web_client, authorize=user_authorize, signing_secret=self.signing_secret, ) app.action("a")(assert_user_context_attributes) request = self.build_valid_request() 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.action({ "callback_id": "pick_channel_for_fun", "type": "interactive_message", })(simple_listener) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 assert self.mock_received_requests["/auth.test"] == 1
async def test_cancellation_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.action("dialog-callback-iddddd")(handle_cancellation) response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1)
async def test_submission_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 assert self.mock_received_requests["/auth.test"] == 1 app.action("dialog-callback-iddddd")(handle_submission) response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1
async def test_failure_without_type(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1 app.action("unknown")(simple_listener) response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1
async def test_failure_without_type(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1) app.action("unknown")(simple_listener) response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1)
async def test_process_before_response(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, process_before_response=True, ) app.action({ "callback_id": "pick_channel_for_fun", "type": "interactive_message", })(simple_listener) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 200 await assert_auth_test_count_async(self, 1)
async def test_submission_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 await assert_auth_test_count_async(self, 1) app.action({ "type": "dialog_submission", "callback_id": "dialog-callback-iddddd" })(handle_submission) response = await app.async_dispatch(request) assert response.status == 404 await assert_auth_test_count_async(self, 1)
async def test_failure(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) request = self.build_valid_request() response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1 app.action({ "callback_id": "unknown", "type": "interactive_message", })(simple_listener) response = await app.async_dispatch(request) assert response.status == 404 assert self.mock_received_requests["/auth.test"] == 1
async def test_cancellation_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.action({ "type": "dialog_cancellation", "callback_id": "dialog-callback-iddddd" })(handle_cancellation) 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