def direct_message_reply_by_person_email(api, direct_message_by_person_email): text = create_string("Reply Message") return api.messages.create( toPersonEmail=direct_message_by_person_email.toPersonEmail, parentId=direct_message_by_person_email.id, text=text, )
def test_delete_message(api, group_room, send_group_room_message): text = create_string("Message") message = api.messages.create(group_room.id, text=text) assert is_valid_message(message) api.messages.delete(message.id) with pytest.raises(webexteamssdk.ApiError): api.messages.get(message.id)
def direct_message_reply_by_person_id(api, direct_message_by_person_id): text = create_string("Reply Message") return api.messages.create( toPersonId=direct_message_by_person_id.toPersonId, parentId=direct_message_by_person_id.id, text=text, )
def group_room_message_reply_by_id(api, group_room, group_room_text_message): text = create_string("Reply Message") return api.messages.create( # roomId=group_room.id, parentId=group_room_text_message.id, text=text, )
def temp_team(api): team = create_team(api, create_string("Team")) yield team if team_exists(api, team): delete_team(api, team)
def direct_messages(api, email_addresses): msg_text = create_string("Message") messages = [] for email in email_addresses: messages.append(api.messages.create(toPersonEmail=email, text=msg_text)) yield messages delete_messages(api, messages)
def direct_message_by_id(api, test_people): person = test_people["member_added_by_id"] message = create_message(api, toPersonId=person.id, text=create_string("Message")) yield message delete_message(api, message)
def direct_message_by_email(api, test_people): person = test_people["member_added_by_email"] message = create_message(api, toPersonEmail=person.emails[0], text=create_string("Message")) yield message delete_message(api, message)
def team_room(api, team): team_room = api.rooms.create( title=create_string("Team Room"), teamId=team.id, ) yield team_room api.rooms.delete(team_room.id)
def group_room_markdown_message(group_room, send_group_room_message, me, group_room_text_message): # Uses / depends-on group_room_text_message to ensure this message is # created after group_room_text_message, so that we can be sure that a # message exists 'before' this one - used to test 'before' list filters. markdown = create_string( "<@personId:{id}|{name}>, This is **markdown** with a mention." "".format(id=me.id, name=me.displayName)) return send_group_room_message(group_room.id, markdown=markdown)
def temp_room(api): room = api.rooms.create(title=create_string("Temp Room")) yield room try: api.rooms.delete(room.id) except webexteamssdk.ApiError: pass
def temp_team(api): team = api.teams.create(create_string("Temp Team")) yield team try: api.teams.delete(team.id) except webexteamssdk.ApiError: pass
def direct_message_by_id(api, test_people): person = test_people["member_added_by_id"] message = api.messages.create( toPersonId=person.id, text=create_string("Message"), ) yield message api.messages.delete(message.id)
def group_room_markdown_message(group_room, send_group_room_message, me, group_room_text_message): # Uses / depends-on group_room_text_message to ensure this message is # created after group_room_text_message, so that we can be sure that a # message exists 'before' this one - used to test 'before' list filters. markdown = create_string( "<@personId:{id}|{name}>, This is **markdown** with a mention." "".format(id=me.id, name=me.displayName) ) return send_group_room_message(group_room.id, markdown=markdown)
def group_room_markdown_message(group_room, send_group_room_message, me, group_room_member_added_by_email, group_room_text_message): # Uses / depends on group_room_text_message to ensure this message is # created after group_room_text_message, so that we can be sure that a # message exists 'before' this one - used to test 'before' list filters. mention_email = me.emails[0] markdown = create_string("<personEmail:{}>, This is **markdown** with a " "mention.".format(mention_email)) return send_group_room_message(group_room.id, markdown=markdown)
def direct_message_by_email(api, test_people): person = test_people["member_added_by_email"] message = api.messages.create( toPersonEmail=person.emails[0], text=create_string("Message"), ) yield message api.messages.delete(message.id)
def group_room_message_with_card( api, group_room, adaptive_card, send_group_room_message, ): return send_group_room_message( room_id=group_room.id, text=create_string("Message"), attachments=[{ "contentType": "application/vnd.microsoft.card.adaptive", "content": adaptive_card, }], )
def direct_message_by_email_with_card(api, test_people, adaptive_card): person = test_people["member_added_by_email"] message = api.messages.create( toPersonEmail=person.emails[0], text=create_string("Message"), attachments=[{ "contentType": "application/vnd.microsoft.card.adaptive", "content": adaptive_card, }], ) yield message api.messages.delete(message.id)
def direct_message_by_email_with_card(api, test_people): attachments = [] attachment = {} attachment['contentType'] = "application/vnd.microsoft.card.adaptive" attachment["content"] = json.loads(open(pathlib.Path(__file__).parent / 'example_card.json').read()) attachments.append(attachment) person = test_people["member_added_by_email"] message = api.messages.create( toPersonEmail=person.emails[0], text=create_string("Message"), attachments=attachments ) yield message api.messages.delete(message.id)
def attachment_action_create(api, test_people, attachment_actions_card): person = test_people["member_added_by_email"] message = api.messages.create( toPersonEmail=person.emails[0], text=create_string("Message"), attachments=[{ "contentType": "application/vnd.microsoft.card.adaptive", "content": attachment_actions_card, }], ) attachment_action = api.attachment_actions.create(type="submit", messageId=message.id, inputs={ "Name": person.displayName, "Email": person.emails[0], }) yield attachment_action api.messages.delete(message.id)
def test_update_team_name(self, api, team): new_name = create_string("Updated Team") team = api.teams.update(team.id, name=new_name) assert is_valid_team(team) assert team.name == new_name
def team(api): team = create_team(api, create_string("Team")) yield team delete_team(api, team)
def test_delete_message(self, api, group_room, send_group_room_message): text = create_string("Message") message = create_message(api, roomId=group_room.id, text=text) assert is_valid_message(message) delete_message(api, message) assert not message_exists(api, message)
def group_room_text_message(group_room, send_group_room_message): text = create_string("Message") return send_group_room_message(group_room.id, text=text)
def test_update_team_name(api, team): new_name = create_string("Updated Team") updated_team = api.teams.update(team.id, name=new_name) assert is_valid_team(updated_team) assert updated_team.name == new_name
def inner(num_rooms): for i in range(num_rooms): rooms.append(api.rooms.create(create_string("Additional Room"))) return rooms
def team(api): team = api.teams.create(create_string("Team")) yield team api.teams.delete(team.id)
def group_room(api): room = create_room(api, create_string("Room")) yield room delete_room(api, room)
def test_update_room_title(api, group_room): new_title = create_string("Updated Group Room") room = api.rooms.update(group_room.id, title=new_title) assert is_valid_room(room) assert room.title == new_title
def inner(num_teams): for i in range(num_teams): teams.append(api.teams.create(create_string("Additional Team"))) return teams
def inner(num_rooms): for i in range(num_rooms): rooms.append(create_room(api, create_string("Additional Room"))) return rooms
def temp_group_room(api): room = create_room(api, create_string("Room")) yield room if room_exists(api, room): delete_room(api, room)
def team_room(api, team): team_room = create_team_room(api, team, create_string("Team Room")) yield team_room delete_room(api, team_room)
def group_room(api): room = api.rooms.create(title=create_string("Group Room")) yield room api.rooms.delete(room.id)
def inner(num_teams): for i in range(num_teams): teams.append(create_team(api, create_string("Additional Team"))) return teams
def test_update_room_title(self, api, group_room): new_title = create_string("Updated Room") room = api.rooms.update(group_room.id, title=new_title) assert is_valid_room(room) assert room.title == new_title