コード例 #1
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_6():
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(admin1, channel1, 'testing')
    message_remove(admin1, 1)
    with pytest.raises(ValueError):
        message_edit(admin1, 1, 'hello world')
コード例 #2
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_2():
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(admin1, channel1,
                 'sorry guys only admins can edit other messages')
    message_send(user1, channel1, 'are you joking? let me test that')
    with pytest.raises(AccessError):
        message_edit(user1, 1, 'testing')
コード例 #3
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_1():
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(admin1, channel1, 'testing 123')
    assert message_edit(admin1, 1, 'new message') == {}
    message_id = 1
    messagedict = message_dict(message_id)
    assert messagedict['message'] == 'new message'
コード例 #4
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_4():
    data = get_data()
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(user1, channel1,
                 "hey admin, did you hear you can edit other people messages")
    message_send(admin1, channel1, 'yep, let me show you my admin rights')
    assert message_edit(admin1, 1, 'imagine not being an admin') == {}
    for messagedict in data['messages']:
        if messagedict['message_id'] == 1:
            assert messagedict['message'] == 'imagine not being an admin'
コード例 #5
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_3():
    data = get_data()
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(admin1, channel1,
                 "hey admin 2, apparently we can edit each others messages")
    message_send(admin2, channel1, 'that sounds pretty standard to me')
    assert message_edit(admin1, 2, 'admin1 is really cool') == {}
    for messagedict in data['messages']:
        if messagedict['message_id'] == 2:
            assert messagedict['message'] == 'admin1 is really cool'
コード例 #6
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_8():
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(admin1, channel1, 'testing')
    with pytest.raises(ValueError):
        message_edit(admin1, 1, 1001 * 'a')
コード例 #7
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_7():
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    message_send(admin1, channel1, 'testing')
    with pytest.raises(AccessError):
        message_edit(user1, 1, 'hello world')
コード例 #8
0
ファイル: message_edit_test.py プロジェクト: keevine/Slackr
def test_message_edit_5():
    user1, user_id1, admin1, admin_id1, admin2, admin_id2, channel1, channel2 = setup(
    )
    with pytest.raises(ValueError):
        message_edit(admin1, 1, 'hello')