'Test raising an XMPPError exception.'

def testXMPPErrorException(self):

    def message(msg):
        raise XMPPError(condition='feature-not-implemented', text="We    don't    do    things    that    way    here.", etype='cancel', extension='foo', extension_ns='foo:error', extension_args={'test': 'true'})
    self.stream_start()
    self.xmpp.add_event_handler('message', message)
    self.recv('\n                                        <message>\n                                                <body>This    is    going    to    cause    an    error.</body>\n                                        </message>\n                                ')
    self.send('\n                                        <message    type="error">\n                                                <error    type="cancel"    code="501">\n                                                        <feature-not-implemented\n                                                                        xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"    />\n                                                        <text    xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">\n                                                                We    don&apos;t    do    things    that    way    here.\n                                                        </text>\n                                                        <foo    xmlns="foo:error"    test="true"    />\n                                                </error>\n                                        </message>\n                                ', use_values=False)
