'Test using setStanzaValues with substanzas and plugins.'

def testSetStanzaValues(self):

    class TestStanzaPlugin(ElementBase, ):
        name = 'pluginfoo'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
        plugin_attrib = 'plugin_foo'
    class TestStanzaPlugin2(ElementBase, ):
        name = 'pluginfoo2'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
        plugin_attrib = 'plugin_foo2'
    class TestSubStanza(ElementBase, ):
        name = 'subfoo'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
    class TestStanza(ElementBase, ):
        name = 'foo'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
    register_stanza_plugin(TestStanza, TestSubStanza, iterable=True)
    register_stanza_plugin(TestStanza, TestStanzaPlugin)
    register_stanza_plugin(TestStanza, TestStanzaPlugin2)
    stanza = TestStanza()
    values = {'bar': 'a', 'baz': '', 'plugin_foo': {'bar': '', 'baz': 'b'}, 'plugin_foo2': {'bar': 'd', 'baz': 'e'}, 'substanzas': [{'__childtag__': '{foo}subfoo', 'bar': 'c', 'baz': ''}]}
    stanza.values = values
    self.check(stanza, '\n                                        <foo    xmlns="foo"    bar="a">\n                                                <pluginfoo    baz="b"    />\n                                                <pluginfoo2    bar="d"    baz="e"    />\n                                                <subfoo    bar="c"    />\n                                        </foo>\n                                ')
