コード例 #1
0
def standupEnd(data, channel_id, token, finish):
    u_id = getUserFromToken(token)
    for channel in data['channels']:
        if str(channel_id == channel['channel_id']):
            standupEndTime = channel['standup_end'] - datetime.datetime.now()
            if (channel['standup_active'] is True):
                standupTerminate(data, channel_id, token, standupEndTime)
                message = channel['standup_messages']
                message_send(data, message, channel_id, token)
コード例 #2
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_message_remove():
    global data
    global token
    global token2
    global token3
    a = message_send(data, "a short message", "C123456", token)
    b = message_send(data, "a short message", "C123456", token)
    c = message_send(data, "a short message", "C123456", token3)
    remove_message(data, a, token)
    with pytest.raises(ValueError, match=r"*"):
        remove_message(data, a, token)
    with pytest.raises(AccessError, match=r"*"):
        remove_message(data, b, token2)
    remove_message(data, c, token)
コード例 #3
0
def messageSend():
    message, channel_id = (request.form[x] for x in ('message', 'channel_id'))
    channel_id = int(channel_id)
    token = request.form.get('token')
    checkTokenValidity(token, data)
    message_id = message_send(data, message, channel_id, token)
    return dumps({'message_id': message_id})
コード例 #4
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_unpin_message():
    pinthis = message_send(data, "asds", "C123456", token)
    apinthis = message_send(
        data, "00000000000000000000000000000000000000000000000000000000",
        "C123456", token)
    pinMessage(data, token, apinthis)
    #print(data)
    unpinMessage(data, token, apinthis)
    #print(data)
    with pytest.raises(ValueError, match=r"*"):
        unpinMessage(data, token, 's23123')
    with pytest.raises(ValueError, match=r"*"):
        unpinMessage(data, token3, pinthis)
    #print(data)
    with pytest.raises(ValueError, match=r"*"):
        unpinMessage(data, token, apinthis)
    pinMessage(data, token, apinthis)
コード例 #5
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_pin_message():
    unpinned = message_send(
        data, "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "C123456",
        token)
    unpinned1 = message_send(
        data, "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "C123456",
        token)
    #print(data['channels'][0])
    pinMessage(data, token, unpinned)
    #print(data['channels'][0])
    #print(data['users'])
    with pytest.raises(ValueError, match=r"*"):
        pinMessage(data, token, 'memeid')
    with pytest.raises(ValueError, match=r"*"):
        pinMessage(data, token3, unpinned1)
    with pytest.raises(ValueError, match=r"*"):
        pinMessage(data, token, unpinned)
コード例 #6
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_react_message():
    global data
    global token
    global token2
    global token3
    unreactedmessage = message_send(data, "a mess to react to", "C123456",
                                    token)
    unreactedmessage2 = message_send(data, "a mess to react to", "C123456",
                                     token)
    # for channels in data['channels']:
    #     for message in channels['messages']:
    #         print(message)
    reactToMessage(data, unreactedmessage, 1, token)
    #print(data)
    with pytest.raises(ValueError, match=r"*"):
        reactToMessage(data, "a12313", 1, token)
    with pytest.raises(ValueError, match=r"*"):
        reactToMessage(data, unreactedmessage2, 2, token)
    with pytest.raises(ValueError, match=r"*"):
        reactToMessage(data, unreactedmessage, 1, token)
コード例 #7
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_message_edit():
    global data
    global token
    global token2
    global token3
    sherrysmes = message_send(data, "a message to be edited", "C123456", token)
    sherrymessage = False
    for channels in data['channels']:
        for message in channels['messages']:
            if message['message_id'] == sherrysmes:
                sherrymessage = True
    assert (sherrymessage == True)
    hansonsmes = message_send(data, "hansons message to be edited", "C123456",
                              token3)
    sherrysfinal = message_send(data, "sherrys final message to be edited",
                                "C123456", token)
    editMessage(data, sherrysmes, "an edited message", token)
    editMessage(data, hansonsmes, "sherry was here", token)
    with pytest.raises(AccessError, match=r"*"):
        editMessage(data, sherrysfinal, "hanson was here", token3)
コード例 #8
0
def test_message_send():
    global data
    global token
    global token2
    a = message_send(data, "a short message", "C123456", token)
    print(data)
    print(
        "==========================================================================="
    )
    print(isUserinChannelbool(data, "33530", "C123456"))
    print(
        "==========================================================================="
    )

    with pytest.raises(AccessError, match=r"*"):
        b = message_send(data, "a short message", "C123456", token2)
    with pytest.raises(ValueError, match=r"*"):
        message_send(
            data,
            "a short asdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessageasdasdsasdasdadsdasdmessage",
            "C123456",
            "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1X2lkIjoiVTY0NTY3In0.7S6sbsXK5U-_inS3L3gr-W2TURad9qEcpYS3nBWbMMA"
        )
    with pytest.raises(AccessError, match=r"*"):
        message_send(data, "a short message", "C123456", token2)
    print(data)
コード例 #9
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_message_send():
    global data
    global token
    global token2
    a = message_send(data, "a short message", "C123456", token)
    print(data)
    print(
        "==========================================================================="
    )
    print(isUserinChannelbool(data, "33530", "C123456"))
    print(
        "==========================================================================="
    )
コード例 #10
0
ファイル: messages_test.py プロジェクト: Mike-SGit/Slackr
def test_unreact_message():
    global data
    global token
    global token2
    global token3
    unreadtedmessage3 = message_send(
        data, "a mess to not IIIIIIIIIIIIIIIIIIIIIIIIII reacted to", "C123456",
        token)
    with pytest.raises(ValueError, match=r"*"):
        unreactMessage(data, unreadtedmessage3, 1, token)
    reactToMessage(data, unreadtedmessage3, 1, token)
    with pytest.raises(ValueError, match=r"*"):
        unreactMessage(data, unreadtedmessage3, 43, token)
    unreactMessage(data, unreadtedmessage3, 1, token)
    with pytest.raises(ValueError, match=r"*"):
        unreactMessage(data, 'memeid', 1, token)