def disconnected_before_reply(q, stream, conn):
    iq = call_create(q, conn, 'slow.localhost')

    call_async(q, conn, 'Disconnect')

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.DISCONNECTED, event.error)
Example #2
0
def disconnected_before_reply(q, stream, conn):
    iq = call_create(q, conn, 'slow.localhost')

    call_async(q, conn, 'Disconnect')

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.DISCONNECTED, event.error)
Example #3
0
def not_a_search_server(q, stream, conn):
    iq = call_create(q, conn, 'notajud.localhost')

    e = domish.Element((None, 'error'))
    e['type'] = 'cancel'
    e.addElement((ns.STANZA, 'service-unavailable'))
    send_error_reply(stream, iq, e)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.NOT_AVAILABLE, event.error)
Example #4
0
def invalid_jid(q, stream, conn):
    iq = call_create(q, conn, 'invalid.localhost')

    e = domish.Element((None, 'error'))
    e['type'] = 'cancel'
    e.addElement((ns.STANZA, 'jid-malformed'))
    send_error_reply(stream, iq, e)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.INVALID_ARGUMENT, event.error)
Example #5
0
def forbidden(q, stream, conn):
    iq = call_create(q, conn, 'notforyou.localhost')

    e = domish.Element((None, 'error'))
    e['type'] = 'cancel'
    e.addElement((ns.STANZA, 'forbidden'))
    send_error_reply(stream, iq, e)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.PERMISSION_DENIED, event.error)
def not_a_search_server(q, stream, conn):
    iq = call_create(q, conn, 'notajud.localhost')

    e = domish.Element((None, 'error'))
    e['type'] = 'cancel'
    e.addElement((ns.STANZA, 'service-unavailable'))
    send_error_reply(stream, iq, e)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.NOT_AVAILABLE, event.error)
def invalid_jid(q, stream, conn):
    iq = call_create(q, conn, 'invalid.localhost')

    e = domish.Element((None, 'error'))
    e['type'] = 'cancel'
    e.addElement((ns.STANZA, 'jid-malformed'))
    send_error_reply(stream, iq, e)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.INVALID_ARGUMENT, event.error)
def forbidden(q, stream, conn):
    iq = call_create(q, conn, 'notforyou.localhost')

    e = domish.Element((None, 'error'))
    e['type'] = 'cancel'
    e.addElement((ns.STANZA, 'forbidden'))
    send_error_reply(stream, iq, e)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.PERMISSION_DENIED, event.error)
Example #9
0
def returns_invalid_fields(q, stream, conn):
    iq = call_create(q, conn, 'broken.localhost')

    result = make_result_iq(stream, iq)
    query = result.firstChildElement()
    for f in ["first", "shoe-size", "nick", "star-sign"]:
        query.addElement(f)
    stream.send(result)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.NOT_AVAILABLE, event.error)
def returns_invalid_fields(q, stream, conn):
    iq = call_create(q, conn, 'broken.localhost')

    result = make_result_iq(stream, iq)
    query = result.firstChildElement()
    for f in ["first", "shoe-size", "nick", "star-sign"]:
        query.addElement(f)
    stream.send(result)

    event = q.expect('dbus-error', method='CreateChannel')
    assertDBusError(cs.NOT_AVAILABLE, event.error)
def really_invalid_jid(q, stream, conn):
    request = dbus.Dictionary(
        {
            cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_SEARCH,
            cs.CONTACT_SEARCH_SERVER: 'this is literally bullshit',
        }, signature='sv')
    call_async(q, conn.Requests, 'CreateChannel', request)

    # If the JID is actually malformed, we shouldn't even get as far as trying
    # to talk to it.
    event = q.expect('dbus-error', method='CreateChannel')

    assertDBusError(cs.INVALID_ARGUMENT, event.error)
Example #12
0
def really_invalid_jid(q, stream, conn):
    request = dbus.Dictionary(
        {
            cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_SEARCH,
            cs.CONTACT_SEARCH_SERVER: 'this is literally bullshit',
        },
        signature='sv')
    call_async(q, conn.Requests, 'CreateChannel', request)

    # If the JID is actually malformed, we shouldn't even get as far as trying
    # to talk to it.
    event = q.expect('dbus-error', method='CreateChannel')

    assertDBusError(cs.INVALID_ARGUMENT, event.error)