Exemple #1
0
def test_message_unpin_8():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(admin1, channel1, 'Test message')
    message_pin(admin1, 1)
    with pytest.raises(AccessError):
        message_unpin(admin3, 1)
Exemple #2
0
def test_message_unpin_4():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(admin1, channel1,
                 'could a user try unpinning this message for test purposes')
    message_pin(admin1, 1)
    with pytest.raises(ValueError):
        message_unpin(user1, 1)
Exemple #3
0
def test_message_unpin_5():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(admin1, channel1,
                 'I wonder what happens if I unpin my own message twice')
    message_pin(admin1, 1)
    message_unpin(admin1, 1)
    with pytest.raises(ValueError):
        message_unpin(admin1, 1)
Exemple #4
0
def test_message_unpin_1():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(admin1, channel1, 'testing 123')
    message_pin(admin1, 1)
    assert message_unpin(admin1, 1) == {}
    message_id = 1
    messagedict = message_dict(message_id)
    assert not messagedict['is_pinned']
Exemple #5
0
def test_message_unpin_3():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(admin1, channel1,
                 'apparently we can unpin each others messages')
    message_send(admin2, channel1, 'let me try that')
    message_pin(admin1, 1)
    assert message_unpin(admin2, 1) == {}
    for messagedict in data['messages']:
        if messagedict['message_id'] == 1:
            assert not messagedict['is_pinned']
Exemple #6
0
def test_message_unpin_2():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(
        user1, channel1,
        'could an admin pin and unpin this message, it is very important')
    message_pin(admin1, 1)
    assert message_unpin(admin1, 1) == {}
    message_id = 1
    messagedict = message_dict(message_id)
    assert not messagedict['is_pinned']
Exemple #7
0
def test_message_unpin_6():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    message_send(admin1, channel1,
                 'I wonder what happens if I unpin my own message twice')
    message_pin(admin1, 1)
    assert message_unpin(admin1, 1) == {}
    message_id = 1
    messagedict = message_dict(message_id)
    assert not messagedict['is_pinned']
    assert message_pin(admin1, 1) == {}
    assert messagedict['is_pinned']
Exemple #8
0
def test_message_unpin_7():
    (data, user1, user_id1, admin1, admin_id1, admin2, admin_id2, admin3,
     admin_id3, channel1, channel2) = setup()
    with pytest.raises(ValueError):
        message_unpin(admin1, 1)