コード例 #1
0
def test_verify_missing_deliver_to(chat):
    msg = Message(
        author=chat.other,
        chat=chat,
        type=MsgType.Text,
        text="Message",
    )
    with pytest.raises(AssertionError):
        msg.verify()
コード例 #2
0
def test_verify_text_msg(chat):
    msg = Message(
        deliver_to=coordinator.master,
        author=chat.other,
        chat=chat,
        type=MsgType.Text,
        text="Message",
    )
    msg.verify()
コード例 #3
0
def test_verify_media_msg(chat, master_channel, media_type):
    with NamedTemporaryFile() as f:
        msg = Message(
            deliver_to=master_channel,
            author=chat.other,
            chat=chat,
            type=media_type,
            file=f,
            filename="test.bin",
            path=f.name,
            mime="application/octet-stream",
        )
        msg.verify()