def test_json_with_block_id(self): self.assertDictEqual( {"type": "divider", "block_id": "foo"}, DividerBlock(block_id="foo").to_dict(), ) self.assertDictEqual( {"type": "divider", "block_id": "foo"}, DividerBlock(**{"type": "divider", "block_id": "foo"}).to_dict(), )
def main(rqst: Union[InteractiveMessageRequest, CommandRequest]) -> None: block_id = cmd.prog + '.main.button' # create a Slack message that will be used to respond to the User's # interaction which was the invocation of the /demo command. resp = Response(rqst) # ------------------------------------------------------------------------- # define the button callback handler to send a response back to the # User telling the time when they pressed the button # ------------------------------------------------------------------------- @rqst.app.ic.block_action.on(block_id) def on_button(btn_rqst: BlockActionRequest, btn_action: ActionEvent): btn_resp = Response(btn_rqst) btn_resp.send_response(text=( f"At timestamp `{btn_action.data['action_ts']}`, " f"you pressed: *{btn_action.value.title()}*") ) # ------------------------------------------------------------------------- # create a message to send to the User that has two buttons; and when # they click either one, the above callback will be executed. # ------------------------------------------------------------------------- user_id = rqst.user_id resp['blocks'] = extract_json([ SectionBlock(text=MarkdownTextObject(text=f'Hi there <@{user_id}>!')), DividerBlock(), ActionsBlock( block_id=block_id, elements=[ ButtonElement( text='Press for Bad', style='danger', action_id=f'{block_id}.bad', value='bad'), ButtonElement( text='Press for Good', style="primary", action_id=f'{block_id}.good', value='good') ] ), DividerBlock() ]) resp.send()
def test_close_in_home_tab(self): modal_view = View(type="home", callback_id="home-tab-id", close=PlainTextObject(text="Cancel"), blocks=[DividerBlock()]) with self.assertRaises(SlackObjectFormationError): modal_view.validate_json()
def divider(self, *, block_id: Optional[str] = None): """A content divider, like an <hr>, to split up different blocks inside of a message. Args: block_id: A string acting as a unique identifier for a block. You can use this block_id when you receive an interaction payload to identify the docs-src of the action. If not specified, one will be generated. Maximum length for this field is 255 characters. block_id should be unique for each message and each iteration of a message. If a message is updated, use a new block_id. https://api.slack.com/reference/block-kit/blocks#divider """ self._blocks.append(DividerBlock(block_id=block_id)) return self
def test_home_tab_construction(self): home_tab_view = View( type="home", blocks=[ SectionBlock(text=MarkdownTextObject( text="*Here's what you can do with Project Tracker:*"), ), ActionsBlock(elements=[ ButtonElement( text=PlainTextObject(text="Create New Task", emoji=True), style="primary", value="create_task", ), ButtonElement( text=PlainTextObject(text="Create New Project", emoji=True), value="create_project", ), ButtonElement( text=PlainTextObject(text="Help", emoji=True), value="help", ), ], ), ContextBlock(elements=[ ImageElement( image_url= "https://api.slack.com/img/blocks/bkb_template_images/placeholder.png", alt_text="placeholder", ), ], ), SectionBlock( text=MarkdownTextObject(text="*Your Configurations*"), ), DividerBlock(), SectionBlock( text=MarkdownTextObject( text= "*#public-relations*\n<fakelink.toUrl.com|PR Strategy 2019> posts new tasks, comments, and project updates to <fakelink.toChannel.com|#public-relations>" ), accessory=ButtonElement( text=PlainTextObject(text="Edit", emoji=True), value="public-relations", ), ), ], ) home_tab_view.validate_json()
async def test_with_blocks(self): url = os.environ[SLACK_SDK_TEST_INCOMING_WEBHOOK_URL] webhook = AsyncWebhookClient(url) response = await webhook.send( text="fallback", blocks=[ SectionBlock( block_id="sb-id", text=MarkdownTextObject( text="This is a mrkdwn text section block."), fields=[ PlainTextObject(text="*this is plain_text text*", emoji=True), MarkdownTextObject(text="*this is mrkdwn text*"), PlainTextObject(text="*this is plain_text text*", emoji=True), ]), DividerBlock(), ActionsBlock(elements=[ ButtonElement( text=PlainTextObject(text="Create New Task", emoji=True), style="primary", value="create_task", ), ButtonElement( text=PlainTextObject(text="Create New Project", emoji=True), value="create_project", ), ButtonElement( text=PlainTextObject(text="Help", emoji=True), value="help", ), ], ), ]) self.assertEqual(200, response.status_code) self.assertEqual("ok", response.body)
def test_valid_construction(self): modal_view = View( type="modal", callback_id="modal-id", title=PlainTextObject(text="Awesome Modal"), submit=PlainTextObject(text="Submit"), close=PlainTextObject(text="Cancel"), blocks=[ InputBlock( block_id="b-id", label=PlainTextObject(text="Input label"), element=PlainTextInputElement(action_id="a-id"), ), InputBlock( block_id="cb-id", label=PlainTextObject(text="Label"), element=CheckboxesElement( action_id="a-cb-id", options=[ Option( text=PlainTextObject( text="*this is plain_text text*"), value="v1", ), Option( text=MarkdownTextObject( text="*this is mrkdwn text*"), value="v2", ), ], ), ), SectionBlock( block_id="sb-id", text=MarkdownTextObject( text="This is a mrkdwn text section block."), fields=[ PlainTextObject(text="*this is plain_text text*", emoji=True), MarkdownTextObject(text="*this is mrkdwn text*"), PlainTextObject(text="*this is plain_text text*", emoji=True), ], ), DividerBlock(), SectionBlock( block_id="rb-id", text=MarkdownTextObject( text= "This is a section block with radio button accessory"), accessory=RadioButtonsElement( initial_option=Option( text=PlainTextObject(text="Option 1"), value="option 1", description=PlainTextObject( text="Description for option 1"), ), options=[ Option( text=PlainTextObject(text="Option 1"), value="option 1", description=PlainTextObject( text="Description for option 1"), ), Option( text=PlainTextObject(text="Option 2"), value="option 2", description=PlainTextObject( text="Description for option 2"), ), ], ), ), ], ) modal_view.validate_json()
def test_json(self): self.assertDictEqual({"type": "divider"}, DividerBlock().to_dict()) self.assertDictEqual({"type": "divider"}, DividerBlock(**{ "type": "divider" }).to_dict())
def test_document(self): input = {"type": "divider"} self.assertDictEqual(input, DividerBlock(**input).to_dict())
from slack.web.classes.blocks import DividerBlock, SectionBlock from slack.web.classes.elements import ButtonElement, ExternalDataSelectElement from slack.web.classes.messages import Message from slack.web.classes.objects import MarkdownTextObject from glados import EventRoutes, GladosBot, GladosPlugin, GladosRequest, RouteType from glados.slack_classes.views import Home HOME_VIEW = Home(blocks=[ SectionBlock(text=MarkdownTextObject( text="*Welcome to GLaDOS From Lambda!*")), DividerBlock(), SectionBlock( text="*Security Events*", fields=["*New Alerts*\n20", "*Open Cases*\n5"], accessory=ButtonElement(text="Go To Security Alerts", action_id="gotoSecurityAlerts", value="go"), ), DividerBlock(), SectionBlock( text="*Service Tickets*", fields=["*Total Tickets*\n23"], accessory=ButtonElement(text="Go To Service Desk", action_id="gotoServiceDesk", value="go"), ), DividerBlock(), SectionBlock( text="Test External Menu", accessory=ExternalDataSelectElement(placeholder="Loading",
def test_json(self): self.assertDictEqual(DividerBlock().to_dict(), {"type": "divider"})
from slack.web.classes.blocks import ContextBlock, SectionBlock, DividerBlock from slack.web.classes.messages import Message from slack.web.classes.objects import ( MarkdownTextObject, PlainTextObject, OptionGroup, Option, ) from slack.web.classes.elements import ButtonElement, ExternalDataSelectElement from slack.web.classes.actions import ActionButton from glados.slack_classes.views import Home HOME_VIEW = Home(blocks=[ SectionBlock(text=MarkdownTextObject(text="*Welcome to GLaDOS!*")), DividerBlock(), SectionBlock( text="*Security Events*", fields=["*New Alerts*\n20", "*Open Cases*\n5"], accessory=ButtonElement(text="Go To Security Alerts", action_id="gotoSecurityAlerts", value="go"), ), DividerBlock(), SectionBlock( text="*Service Tickets*", fields=["*Total Tickets*\n23"], accessory=ButtonElement(text="Go To Service Desk", action_id="gotoServiceDesk", value="go"), ),
def test_coverage(self): for api_method in self.all_api_methods: if self.api_methods_to_call.count(api_method) == 0: continue method_name = api_method.replace(".", "_") method = getattr(self.client, method_name, None) # Run the api calls with required arguments if callable(method): if method_name == "admin_apps_approve": self.api_methods_to_call.remove( method(app_id="AID123", request_id="RID123")["method"]) elif method_name == "admin_inviteRequests_approve": self.api_methods_to_call.remove( method(invite_request_id="ID123")["method"]) elif method_name == "admin_inviteRequests_deny": self.api_methods_to_call.remove( method(invite_request_id="ID123")["method"]) elif method_name == "admin_teams_admins_list": self.api_methods_to_call.remove( method(team_id="T123")["method"]) elif method_name == "admin_teams_create": self.api_methods_to_call.remove( method(team_domain="awesome-team", team_name="Awesome Team")["method"]) elif method_name == "admin_teams_owners_list": self.api_methods_to_call.remove( method(team_id="T123")["method"]) elif method_name == "admin_teams_settings_info": self.api_methods_to_call.remove( method(team_id="T123")["method"]) elif method_name == "admin_teams_settings_setDefaultChannels": self.api_methods_to_call.remove( method(team_id="T123", channel_ids=["C123", "C234"])["method"]) method(team_id="T123", channel_ids="C123,C234") elif method_name == "admin_teams_settings_setDescription": self.api_methods_to_call.remove( method(team_id="T123", description="Workspace for an awesome team") ["method"]) elif method_name == "admin_teams_settings_setDiscoverability": self.api_methods_to_call.remove( method(team_id="T123", discoverability="invite_only")["method"]) elif method_name == "admin_teams_settings_setIcon": self.api_methods_to_call.remove( method( team_id="T123", image_url= "https://www.example.com/images/dummy.png", )["method"]) elif method_name == "admin_teams_settings_setName": self.api_methods_to_call.remove( method(team_id="T123", name="Awesome Engineering Team")["method"]) elif method_name == "admin_usergroups_addChannels": self.api_methods_to_call.remove( method( team_id="T123", usergroup_id="S123", channel_ids=["C1A2B3C4D", "C26Z25Y24"], )["method"]) method( team_id="T123", usergroup_id="S123", channel_ids="C1A2B3C4D,C26Z25Y24", ) elif method_name == "admin_usergroups_listChannels": self.api_methods_to_call.remove( method(usergroup_id="S123")["method"]) method(usergroup_id="S123", include_num_members=True, team_id="T123") method(usergroup_id="S123", include_num_members="1", team_id="T123") method(usergroup_id="S123", include_num_members=1, team_id="T123") method(usergroup_id="S123", include_num_members=False, team_id="T123") method(usergroup_id="S123", include_num_members="0", team_id="T123") method(usergroup_id="S123", include_num_members=0, team_id="T123") elif method_name == "admin_usergroups_removeChannels": self.api_methods_to_call.remove( method( team_id="T123", usergroup_id="S123", channel_ids=["C1A2B3C4D", "C26Z25Y24"], )["method"]) method( team_id="T123", usergroup_id="S123", channel_ids="C1A2B3C4D,C26Z25Y24", ) elif method_name == "admin_users_assign": self.api_methods_to_call.remove( method(team_id="T123", user_id="W123")["method"]) elif method_name == "admin_users_invite": self.api_methods_to_call.remove( method( team_id="T123", email="*****@*****.**", channel_ids=["C1A2B3C4D", "C26Z25Y24"], )["method"]) method( team_id="T123", email="*****@*****.**", channel_ids="C1A2B3C4D,C26Z25Y24", ) elif method_name == "admin_users_list": self.api_methods_to_call.remove( method(team_id="T123")["method"]) elif method_name == "admin_users_remove": self.api_methods_to_call.remove( method(team_id="T123", user_id="W123")["method"]) elif method_name == "admin_users_setAdmin": self.api_methods_to_call.remove( method(team_id="T123", user_id="W123")["method"]) elif method_name == "admin_users_setExpiration": self.api_methods_to_call.remove( method(team_id="T123", user_id="W123", expiration_ts=123)["method"]) elif method_name == "admin_users_setOwner": self.api_methods_to_call.remove( method(team_id="T123", user_id="W123")["method"]) elif method_name == "admin_users_setRegular": self.api_methods_to_call.remove( method(team_id="T123", user_id="W123")["method"]) elif method_name == "admin_users_session_reset": self.api_methods_to_call.remove( method(user_id="W123")["method"]) elif method_name == "calls_add": self.api_methods_to_call.remove( method( external_unique_id="unique-id", join_url="https://www.example.com", )["method"]) elif method_name == "calls_end": self.api_methods_to_call.remove( method(id="R111")["method"]) elif method_name == "calls_info": self.api_methods_to_call.remove( method(id="R111")["method"]) elif method_name == "calls_participants_add": self.api_methods_to_call.remove( method( id="R111", users=[{ "slack_id": "U1H77" }, { "external_id": "54321678", "display_name": "External User", "avatar_url": "https://example.com/users/avatar1234.jpg" }], )["method"]) elif method_name == "calls_update": self.api_methods_to_call.remove( method(id="R111")["method"]) elif method_name == "chat_delete": self.api_methods_to_call.remove( method(channel="C123", ts="123.123")["method"]) elif method_name == "chat_deleteScheduledMessage": self.api_methods_to_call.remove( method(channel="C123", scheduled_message_id="123")["method"]) elif method_name == "chat_getPermalink": self.api_methods_to_call.remove( method(channel="C123", message_ts="123.123")["method"]) elif method_name == "chat_meMessage": self.api_methods_to_call.remove( method(channel="C123", text=":wave: Hi there!")["method"]) elif method_name == "chat_postEphemeral": self.api_methods_to_call.remove( method(channel="C123", user="******")["method"]) elif method_name == "chat_postMessage": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "chat_scheduleMessage": self.api_methods_to_call.remove( method(channel="C123", post_at=123, text="Hi")["method"]) elif method_name == "chat_unfurl": self.api_methods_to_call.remove( method( channel="C123", ts="123.123", unfurls={ "https://example.com/": { "text": "Every day is the test." } }, )["method"]) elif method_name == "chat_update": self.api_methods_to_call.remove( method(channel="C123", ts="123.123")["method"]) elif method_name == "conversations_archive": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_close": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_create": self.api_methods_to_call.remove( method(name="announcements")["method"]) elif method_name == "conversations_history": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_info": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_invite": self.api_methods_to_call.remove( method(channel="C123", users=["U2345678901", "U3456789012"])["method"]) method(channel="C123", users="U2345678901,U3456789012") elif method_name == "conversations_join": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_kick": self.api_methods_to_call.remove( method(channel="C123", user="******")["method"]) elif method_name == "conversations_leave": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_members": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "conversations_rename": self.api_methods_to_call.remove( method(channel="C123", name="new-name")["method"]) elif method_name == "conversations_replies": self.api_methods_to_call.remove( method(channel="C123", ts="123.123")["method"]) elif method_name == "conversations_setPurpose": self.api_methods_to_call.remove( method(channel="C123", purpose="The purpose")["method"]) elif method_name == "conversations_setTopic": self.api_methods_to_call.remove( method(channel="C123", topic="The topic")["method"]) elif method_name == "conversations_unarchive": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "dialog_open": self.api_methods_to_call.remove( method(dialog={}, trigger_id="123")["method"]) elif method_name == "dnd_setSnooze": self.api_methods_to_call.remove( method(num_minutes=120)["method"]) elif method_name == "dnd_teamInfo": self.api_methods_to_call.remove( method(users=["123", "U234"])["method"]) method(users="U123,U234") elif method_name == "files_comments_delete": self.api_methods_to_call.remove( method(file="F123", id="FC123")["method"]) elif method_name == "files_delete": self.api_methods_to_call.remove( method(file="F123")["method"]) elif method_name == "files_info": self.api_methods_to_call.remove( method(file="F123")["method"]) elif method_name == "files_revokePublicURL": self.api_methods_to_call.remove( method(file="F123")["method"]) elif method_name == "files_sharedPublicURL": self.api_methods_to_call.remove( method(file="F123")["method"]) elif method_name == "files_upload": self.api_methods_to_call.remove( method(content="This is the content")["method"]) elif method_name == "files_remote_add": self.api_methods_to_call.remove( method( external_id="123", external_url= "https://www.example.com/remote-files/123", title="File title", )["method"]) elif method_name == "files_remote_share": self.api_methods_to_call.remove( method(channels="C123,G123")["method"]) method(channels=["C123", "G123"]) method(channels="C123,G123") elif method_name == "migration_exchange": self.api_methods_to_call.remove( method(users="U123,U234")["method"]) method(users="U123,U234") elif method_name == "mpim_open": self.api_methods_to_call.remove( method(users="U123,U234")["method"]) method(users="U123,U234") elif method_name == "oauth_access": method = getattr(self.no_token_client, method_name, None) method(client_id="123.123", client_secret="secret", code="123456") elif method_name == "oauth_v2_access": method = getattr(self.no_token_client, method_name, None) method(client_id="123.123", client_secret="secret", code="123456") elif method_name == "pins_add": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "pins_list": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "pins_remove": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "reactions_add": self.api_methods_to_call.remove( method(name="eyes")["method"]) elif method_name == "reactions_remove": self.api_methods_to_call.remove( method(name="eyes")["method"]) elif method_name == "reminders_add": self.api_methods_to_call.remove( method(text="The task", time=123)["method"]) elif method_name == "reminders_complete": self.api_methods_to_call.remove( method(reminder="R123")["method"]) elif method_name == "reminders_delete": self.api_methods_to_call.remove( method(reminder="R123")["method"]) elif method_name == "reminders_info": self.api_methods_to_call.remove( method(reminder="R123")["method"]) elif method_name == "search_all": self.api_methods_to_call.remove( method(query="Slack")["method"]) elif method_name == "search_files": self.api_methods_to_call.remove( method(query="Slack")["method"]) elif method_name == "search_messages": self.api_methods_to_call.remove( method(query="Slack")["method"]) elif method_name == "usergroups_create": self.api_methods_to_call.remove( method(name="Engineering Team")["method"]) elif method_name == "usergroups_disable": self.api_methods_to_call.remove( method(usergroup="UG123")["method"]) elif method_name == "usergroups_enable": self.api_methods_to_call.remove( method(usergroup="UG123")["method"]) elif method_name == "usergroups_update": self.api_methods_to_call.remove( method(usergroup="UG123")["method"]) elif method_name == "usergroups_users_list": self.api_methods_to_call.remove( method(usergroup="UG123")["method"]) elif method_name == "usergroups_users_update": self.api_methods_to_call.remove( method(usergroup="UG123", users=["U123", "U234"])["method"]) method(usergroup="UG123", users="U123,U234") elif method_name == "users_getPresence": self.api_methods_to_call.remove( method(user="******")["method"]) elif method_name == "users_info": self.api_methods_to_call.remove( method(user="******")["method"]) elif method_name == "users_lookupByEmail": self.api_methods_to_call.remove( method(email="*****@*****.**")["method"]) elif method_name == "users_setPhoto": self.api_methods_to_call.remove( method(image="README.md")["method"]) elif method_name == "users_setPresence": self.api_methods_to_call.remove( method(presence="away")["method"]) elif method_name == "views_open": self.api_methods_to_call.remove( method(trigger_id="123123", view={})["method"]) method(trigger_id="123123", view=View(type="modal", blocks=[DividerBlock()])) elif method_name == "views_publish": self.api_methods_to_call.remove( method(user_id="U123", view={})["method"]) elif method_name == "views_push": self.api_methods_to_call.remove( method(trigger_id="123123", view={})["method"]) elif method_name == "views_update": self.api_methods_to_call.remove( method(view_id="V123", view={})["method"]) elif method_name == "channels_archive": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "channels_create": self.api_methods_to_call.remove( method(name="channel-name")["method"]) elif method_name == "channels_history": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "channels_info": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "channels_invite": self.api_methods_to_call.remove( method(channel="C123", user="******")["method"]) elif method_name == "channels_join": self.api_methods_to_call.remove( method(name="channel-name")["method"]) elif method_name == "channels_kick": self.api_methods_to_call.remove( method(channel="C123", user="******")["method"]) elif method_name == "channels_leave": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "channels_mark": self.api_methods_to_call.remove( method(channel="C123", ts="123.123")["method"]) elif method_name == "channels_rename": self.api_methods_to_call.remove( method(channel="C123", name="new-name")["method"]) elif method_name == "channels_replies": self.api_methods_to_call.remove( method(channel="C123", thread_ts="123.123")["method"]) elif method_name == "channels_setPurpose": self.api_methods_to_call.remove( method(channel="C123", purpose="The purpose")["method"]) elif method_name == "channels_setTopic": self.api_methods_to_call.remove( method(channel="C123", topic="The topic")["method"]) elif method_name == "channels_unarchive": self.api_methods_to_call.remove( method(channel="C123")["method"]) elif method_name == "groups_archive": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "groups_create": self.api_methods_to_call.remove( method(name="private-channel-name")["method"]) elif method_name == "groups_createChild": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "groups_history": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "groups_info": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "groups_invite": self.api_methods_to_call.remove( method(channel="G123", user="******")["method"]) elif method_name == "groups_kick": self.api_methods_to_call.remove( method(channel="G123", user="******")["method"]) elif method_name == "groups_leave": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "groups_mark": self.api_methods_to_call.remove( method(channel="C123", ts="123.123")["method"]) elif method_name == "groups_open": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "groups_rename": self.api_methods_to_call.remove( method(channel="G123", name="new-name")["method"]) elif method_name == "groups_replies": self.api_methods_to_call.remove( method(channel="G123", thread_ts="123.123")["method"]) elif method_name == "groups_setPurpose": self.api_methods_to_call.remove( method(channel="G123", purpose="The purpose")["method"]) elif method_name == "groups_setTopic": self.api_methods_to_call.remove( method(channel="G123", topic="The topic")["method"]) elif method_name == "groups_unarchive": self.api_methods_to_call.remove( method(channel="G123")["method"]) elif method_name == "im_close": self.api_methods_to_call.remove( method(channel="D123")["method"]) elif method_name == "im_history": self.api_methods_to_call.remove( method(channel="D123")["method"]) elif method_name == "im_mark": self.api_methods_to_call.remove( method(channel="D123", ts="123.123")["method"]) elif method_name == "im_open": self.api_methods_to_call.remove( method(user="******")["method"]) elif method_name == "im_replies": self.api_methods_to_call.remove( method(channel="D123", thread_ts="123.123")["method"]) elif method_name == "mpim_close": self.api_methods_to_call.remove( method(channel="D123")["method"]) elif method_name == "mpim_history": self.api_methods_to_call.remove( method(channel="D123")["method"]) elif method_name == "mpim_mark": self.api_methods_to_call.remove( method(channel="D123", ts="123.123")["method"]) elif method_name == "mpim_open": self.api_methods_to_call.remove( method(users=["U123", "U234"])["method"]) method(users="U123,U234") elif method_name == "mpim_replies": self.api_methods_to_call.remove( method(channel="D123", thread_ts="123.123")["method"]) else: self.api_methods_to_call.remove(method(*{})["method"]) else: # Verify if the expected method is supported self.assertTrue(callable(method), f"{method_name} is not supported yet") self.assertEqual(self.api_methods_to_call, [], "All methods should be supported")