'Test basic operations of exceptionFromStanza.
Given a realistic stanza, check if a sane exception is returned.
Using this stanza::
<iq type=\'error\'
from=\'pubsub.shakespeare.lit\'
to=\'francisco@denmark.lit/barracks\'
id=\'subscriptions1\'>
<pubsub xmlns=\'http://jabber.org/protocol/pubsub\'>
<subscriptions/>
</pubsub>
<error type=\'cancel\'>
<feature-not-implemented
xmlns=\'urn:ietf:params:xml:ns:xmpp-stanzas\'/>
<unsupported xmlns=\'http://jabber.org/protocol/pubsub#errors\'
feature=\'retrieve-subscriptions\'/>
</error>
</iq>'

def test_basic(self):

    stanza = domish.Element((None, 'stanza'))
    p = stanza.addElement(('http://jabber.org/protocol/pubsub', 'pubsub'))
    p.addElement('subscriptions')
    e = stanza.addElement('error')
    e['type'] = 'cancel'
    e.addElement((NS_XMPP_STANZAS, 'feature-not-implemented'))
    uc = e.addElement(('http://jabber.org/protocol/pubsub#errors', 'unsupported'))
    uc['feature'] = 'retrieve-subscriptions'
    result = error.exceptionFromStanza(stanza)
    self.assertIsInstance(result, error.StanzaError)
    self.assertEqual('feature-not-implemented', result.condition)
    self.assertEqual('cancel', result.type)
    self.assertEqual(uc, result.appCondition)
    self.assertEqual([p], result.children)
