Ejemplo n.º 1
0
def test_good_message():
    """ Make sure backend creates IncomingMessage properly """
    backend = MachBackend(name="mach", router=None, **basic_conf)
    data = {'snr': '1112229999', 'msg': 'Hi'}
    message = backend.message(data)
    assert_true(isinstance(message, IncomingMessage))
    assert_true(isinstance(message.connection, Connection))
    assert_equals(message.connection.identity, data['snr'])
    assert_equals(message.text, data['msg'])
Ejemplo n.º 2
0
def test_good_message():
    """ Make sure backend creates IncomingMessage properly """
    backend = MachBackend(name="mach", router=None, **basic_conf)
    data = {'snr': '1112229999', 'msg': 'Hi'}
    message = backend.message(data)
    assert_true(isinstance(message, IncomingMessage))
    assert_true(isinstance(message.connection, Connection))
    assert_equals(message.connection.identity, data['snr'])
    assert_equals(message.text, data['msg'])
Ejemplo n.º 3
0
def test_incoming_unicode_characters():
    backend = MachBackend(name="mach", router=None, **basic_conf)
    text = random_unicode_string(20)
    data = {'snr': '1112229999', 'msg': text}
    message = backend.message(data)
    assert_equals(text, message.text)
Ejemplo n.º 4
0
def test_bad_message():
    """ Don't die if POSTed data doesn't contain the necessary items """
    backend = MachBackend(name="mach", router=None, **basic_conf)
    data = {'foo': 'moo'}
    message = backend.message(data)
    assert_equals(message, None)
Ejemplo n.º 5
0
def test_incoming_unicode_characters():
    backend = MachBackend(name="mach", router=None, **basic_conf)
    text = random_unicode_string(20)
    data = {'snr': '1112229999', 'msg': text}
    message = backend.message(data)
    assert_equals(text, message.text)
Ejemplo n.º 6
0
def test_bad_message():
    """ Don't die if POSTed data doesn't contain the necessary items """
    backend = MachBackend(name="mach", router=None, **basic_conf)
    data = {'foo': 'moo'}
    message = backend.message(data)
    assert_equals(message, None)