'Test using interface overrides.'

def testOverrides(self):

    class TestStanza(ElementBase, ):
        name = 'foo'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
    class TestOverride(ElementBase, ):
        name = 'overrider'
        namespace = 'foo'
        plugin_attrib = name
        interfaces = set(('bar',))
        overrides = ['set_bar']
        def setup(self, xml):
            self.xml = ET.Element('')
        def set_bar(self, value):
            if (not value.startswith('override-')):
                self.parent()._set_attr('bar', ('override-%s' % value))
            else:
                self.parent()._set_attr('bar', value)
    stanza = TestStanza()
    stanza['bar'] = 'foo'
    self.check(stanza, '\n                                        <foo    xmlns="foo"    bar="foo"    />\n                                ')
    register_stanza_plugin(TestStanza, TestOverride, overrides=True)
    stanza = TestStanza()
    stanza['bar'] = 'foo'
    self.check(stanza, '\n                                        <foo    xmlns="foo"    bar="override-foo"    />\n                                ')
