Example #1
0
def test_send_receive():
    utils.send('Something')

    messages = utils.receive('nothing')
    assert messages == None

    messages = list(utils.receive())
    assert len(messages) == 1
    assert messages[0]['type'] == BASE_MESSAGE_TYPE
Example #2
0
def test_send_receive_type():
    result = utils.send('Something', type='error')
    assert result == True

    messages = list(utils.receive(type='nothing'))
    assert len(messages) == 0

    messages = list(utils.receive())
    assert len(messages) == 0

    messages = list(utils.receive(type='error'))
    assert len(messages) == 1
Example #3
0
def test_send_receive_some():
    """verify we get all message if there are some"""
    utils.send('Tomorrow, and tomorrow, and tomorrow,')
    utils.send('Creeps in this petty pace from day to day,')
    utils.send('To the last syllable of recorded time;')
    utils.send('And all our yesterdays have lighted fools')
    utils.send('The way to dusty death. Out, out, brief candle!')

    messages = list(utils.receive())
    assert len(messages) == 5
Example #4
0
def test_send_receive_failing_name():
    messages = utils.receive(name='unexisting')
    assert messages == None

    result = utils.send('Some message', name='unexisting')
    assert result == False