'Test the \'payload\' interface of StanzaBase.'

def testPayload(self):

    stanza = StanzaBase()
    self.failUnless((stanza['payload'] == []), 'Empty    stanza    does    not    have    an    empty    payload.')
    stanza['payload'] = ET.Element('{foo}foo')
    self.failUnless((len(stanza['payload']) == 1), 'Stanza    contents    and    payload    do    not    match.')
    stanza['payload'] = ET.Element('{bar}bar')
    self.failUnless((len(stanza['payload']) == 2), 'Stanza    payload    was    not    appended.')
    del stanza['payload']
    self.failUnless((stanza['payload'] == []), 'Stanza    payload    not    cleared    after    deletion.')
    stanza['payload'] = [ET.Element('{foo}foo'), ET.Element('{bar}bar')]
    self.failUnless((len(stanza['payload']) == 2), "Adding    multiple    elements    to    stanza's    payload    did    not    work.")
