예제 #1
0
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,
    )
예제 #2
0
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)
예제 #3
0
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,
    )
예제 #4
0
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,
    )
예제 #5
0
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)
예제 #6
0
def temp_team(api):
    team = create_team(api, create_string("Team"))

    yield team

    if team_exists(api, team):
        delete_team(api, team)
예제 #7
0
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)
예제 #8
0
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)
예제 #9
0
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)
예제 #10
0
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)
예제 #11
0
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)
예제 #12
0
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
예제 #13
0
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)
예제 #14
0
def temp_team(api):
    team = api.teams.create(create_string("Temp Team"))

    yield team

    try:
        api.teams.delete(team.id)
    except webexteamssdk.ApiError:
        pass
예제 #15
0
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
예제 #16
0
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)
예제 #17
0
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)
예제 #18
0
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)
예제 #19
0
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)
예제 #20
0
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)
예제 #21
0
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)
예제 #22
0
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,
        }],
    )
예제 #23
0
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)
예제 #24
0
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)
예제 #25
0
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)
예제 #26
0
 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
예제 #27
0
def team(api):
    team = create_team(api, create_string("Team"))
    yield team
    delete_team(api, team)
예제 #28
0
 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)
예제 #29
0
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)
예제 #30
0
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
예제 #31
0
 def inner(num_rooms):
     for i in range(num_rooms):
         rooms.append(api.rooms.create(create_string("Additional Room")))
     return rooms
예제 #32
0
def team(api):
    team = api.teams.create(create_string("Team"))

    yield team

    api.teams.delete(team.id)
예제 #33
0
def group_room(api):
    room = create_room(api, create_string("Room"))
    yield room
    delete_room(api, room)
예제 #34
0
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
예제 #35
0
 def inner(num_teams):
     for i in range(num_teams):
         teams.append(api.teams.create(create_string("Additional Team")))
     return teams
예제 #36
0
 def inner(num_rooms):
     for i in range(num_rooms):
         rooms.append(create_room(api, create_string("Additional Room")))
     return rooms
예제 #37
0
def temp_group_room(api):
    room = create_room(api, create_string("Room"))
    yield room
    if room_exists(api, room):
        delete_room(api, room)
예제 #38
0
def team_room(api, team):
    team_room = create_team_room(api, team, create_string("Team Room"))
    yield team_room
    delete_room(api, team_room)
예제 #39
0
def group_room(api):
    room = api.rooms.create(title=create_string("Group Room"))

    yield room

    api.rooms.delete(room.id)
예제 #40
0
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)
예제 #41
0
 def inner(num_teams):
     for i in range(num_teams):
         teams.append(create_team(api, create_string("Additional Team")))
     return teams
예제 #42
0
 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