'Test retrieving items from a roster stanza.'

def testGetItems(self):

    xml_string = '\n                                        <iq>\n                                                <query    xmlns="jabber:iq:roster">\n                                                        <item    jid="user@example.com"    name="User"    subscription="both">\n                                                                <group>Friends</group>\n                                                                <group>Coworkers</group>\n                                                        </item>\n                                                        <item    jid="otheruser@example.com"    name="Other    User"\n                                                                                subscription="both"    />\n                                                </query>\n                                        </iq>\n                                '
    iq = self.Iq(ET.fromstring(xml_string))
    expected = {'user@example.com': {'name': 'User', 'subscription': 'both', 'ask': '', 'approved': '', 'groups': ['Friends', 'Coworkers']}, 'otheruser@example.com': {'name': 'Other    User', 'subscription': 'both', 'ask': '', 'approved': '', 'groups': []}}
    debug = "Roster    items    don't    match    after    retrieval."
    debug += ('\nReturned:    %s' % str(iq['roster']['items']))
    debug += ('\nExpected:    %s' % str(expected))
    self.failUnless((iq['roster']['items'] == expected), debug)
