'Test modifying top level attributes of a stanza\'s XML object.'

def testModifyingAttributes(self):

    class TestStanza(ElementBase, ):
        name = 'foo'
        namespace = 'foo'
        interfaces = set(('bar', 'baz'))
    stanza = TestStanza()
    self.check(stanza, '\n                                        <foo    xmlns="foo"    />\n                                ')
    self.failUnless((stanza._get_attr('bar') == ''), 'Incorrect    value    returned    for    an    unset    XML    attribute.')
    stanza._set_attr('bar', 'a')
    stanza._set_attr('baz', 'b')
    self.check(stanza, '\n                                        <foo    xmlns="foo"    bar="a"    baz="b"    />\n                                ')
    self.failUnless((stanza._get_attr('bar') == 'a'), 'Retrieved    XML    attribute    value    is    incorrect.')
    stanza._set_attr('bar', None)
    stanza._del_attr('baz')
    self.check(stanza, '\n                                        <foo    xmlns="foo"    />\n                                ')
    self.failUnless((stanza._get_attr('bar', 'c') == 'c'), 'Incorrect    default    value    returned    for    an    unset    XML    attribute.')
