Ejemplo n.º 1
0
def test_send_success_without_id_and_type(message):
    with pytest.raises(Exception) as exc:
        send_success(message=message,
                     message_id=None,
                     handler=None,
                     some_field='additional_info')
    assert 'ID and handler' in str(exc.value)
Ejemplo n.º 2
0
def test_send_success_with_additional_data(message):
    send_success(message=message,
                 message_id=1,
                 handler='some_handler',
                 some_field='additional_info')
    data = message.reply_channel.data
    assert len(data) == 1
    assert data[0]['id'] == 1
    assert data[0]['type'] == 'some_handler'
    assert data[0]['data']['some_field'] == 'additional_info'
    assert 'some_field' not in data[0]
Ejemplo n.º 3
0
def test_send_success(message):
    send_success(message=message, message_id=1, handler='some_handler')
    data = message.reply_channel.data
    assert len(data) == 1
    assert data[0]['id'] == 1
    assert data[0]['type'] == 'some_handler'
Ejemplo n.º 4
0
def test_send_success_without_id(message):
    with pytest.raises(Exception) as exc:
        send_success(message=message, message_id=None, handler='some_handler')
    assert 'ID and handler' in str(exc.value)