'Test retrieving the contents of a sub element.'

def testGetSubText(self):

    class TestStanza(ElementBase, ):
        name = 'foo'
        namespace = 'foo'
        interfaces = set(('bar',))
        def setBar(self, value):
            wrapper = ET.Element('{foo}wrapper')
            bar = ET.Element('{foo}bar')
            bar.text = value
            wrapper.append(bar)
            self.xml.append(wrapper)
        def getBar(self):
            return self._get_sub_text('wrapper/bar', default='not    found')
    stanza = TestStanza()
    self.failUnless((stanza['bar'] == 'not    found'), 'Default    _get_sub_text    value    incorrect.')
    stanza['bar'] = 'found'
    self.check(stanza, '\n                                        <foo    xmlns="foo">\n                                                <wrapper>\n                                                        <bar>found</bar>\n                                                </wrapper>\n                                        </foo>\n                                ')
    self.failUnless((stanza['bar'] == 'found'), ('_get_sub_text    value    incorrect:    %s.' % stanza['bar']))
