示例#1
0
    def testPrefixesLang(self):
        XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><message xml:lang='fr' to='*****@*****.**'><body>test</body></message></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)
        self.failUnless(e[0]==u"<message to='*****@*****.**' xml:lang='fr'><body>test</body></message>", 'invalid xml')
示例#2
0
    def testPrefsCdata(self):

        XML = """<body rid='4017760695' xmlns='http://jabber.org/protocol/httpbind' sid='74a730628186b053a953999bc2ae7dba'>
      <iq id='6161:setprefs' type='set' xmlns='jabber:client'>
        <query xmlns='jabber:iq:private'>
          <preferences xmlns='http://chesspark.com/xml/chesspark-01'>
            <statuses>
              <away>test2</away>
              <available>test1</available>
            </statuses>
            <favorite-channels>
              <channel jid='*****@*****.**' autojoin='no'/>
              <channel jid='*****@*****.**' autojoin='no'/>
              <channel jid='*****@*****.**' autojoin='no'/>
            </favorite-channels>
            <time-controls/>
            <searchfilters>
              <filter node='play'>
                <variant name='standard'/>
              </filter>
              <filter open='yes' node='watch'>
                <computer/>
              </filter>
              <filter node='adjourned'>
                <computer/>
              </filter>
              <filter node='myads'>
                <computer/>
              </filter>
            </searchfilters>
            <loginrooms>
              <room>[email protected]</room>
            </loginrooms>
            <noinitialroster/>
            <boardsize size='61'/>
            <volume setting='100'/>
            <hidewelcomedialog/>
            <showoffline/>
            <showavatars/>
            <showmucpresenceinchat/>
            <hideparticipants/>
            <newlineonshift/>
            <nochatnotify/>
            <no-gameboard-autoresize/>
            <messagewhenplaying/>
            <hidegamefinderhelp/>
            <hidewarningondisconnect/>
            <disablesounds/>
            <nogamesearchonlogin/>
          </preferences>
        </query>
      </iq>
    </body>"""


        hp = HttpbParse()

        b, e = hp.parse(XML)

        self.failUnless(e[0]=="<iq xmlns='jabber:client' id='6161:setprefs' type='set'>\n        <query xmlns='jabber:iq:private'>\n          <preferences xmlns='http://chesspark.com/xml/chesspark-01'>\n            <statuses>\n              <away>test2</away>\n              <available>test1</available>\n            </statuses>\n            <favorite-channels>\n              <channel jid='*****@*****.**' autojoin='no'/>\n              <channel jid='*****@*****.**' autojoin='no'/>\n              <channel jid='*****@*****.**' autojoin='no'/>\n            </favorite-channels>\n            <time-controls/>\n            <searchfilters>\n              <filter node='play'>\n                <variant name='standard'/>\n              </filter>\n              <filter open='yes' node='watch'>\n                <computer/>\n              </filter>\n              <filter node='adjourned'>\n                <computer/>\n              </filter>\n              <filter node='myads'>\n                <computer/>\n              </filter>\n            </searchfilters>\n            <loginrooms>\n              <room>[email protected]</room>\n            </loginrooms>\n            <noinitialroster/>\n            <boardsize size='61'/>\n            <volume setting='100'/>\n            <hidewelcomedialog/>\n            <showoffline/>\n            <showavatars/>\n            <showmucpresenceinchat/>\n            <hideparticipants/>\n            <newlineonshift/>\n            <nochatnotify/>\n            <no-gameboard-autoresize/>\n            <messagewhenplaying/>\n            <hidegamefinderhelp/>\n            <hidewarningondisconnect/>\n            <disablesounds/>\n            <nogamesearchonlogin/>\n          </preferences>\n        </query>\n      </iq>", 'invalid xml')
示例#3
0
    def testTime(self):
        XML = """
 <body rid='4019888743' xmlns='http://jabber.org/protocol/httpbind' sid='948972a64d524f862107cdbd748d1d16'><iq id='980:getprefs' type='get'><query xmlns='jabber:iq:private'><preferences xmlns='http://chesspark.com/xml/chesspark-01'/></query></iq><iq id='981:getallignorelists' type='get'><query xmlns='jabber:iq:privacy'/></iq><test/><testing><ha/></testing></body>
"""
        t = time.time()

        for i in range(0, 10000):
            hp = HttpbParse(use_t=True)
            b, elems = hp.parse(XML)
            for e in elems:
                x = e.toXml()
        td = time.time() - t


        t = time.time()
        for i in range(0, 10000):
            hp = HttpbParse()
            b, elems = hp.parse(XML)
            for e in elems:
                if type(u'') == type(e):
                    x = e
                
        ntd = time.time() - t
        
        self.failUnless(td>ntd, 'Not faster')
示例#4
0
    def testCDATA(self):
        XML = """<body rid='3116008962' xmlns='http://jabber.org/protocol/httpbind' sid='88be95e7ebbd8c12465e311ce73fb8ac'><response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InRvZnUiLHJlYWxtPSJkZXYuY2hlc3NwYXJrLmNvbSIsbm9uY2U9Ik5SaW5HQkNaWjg0U09Ea1BzMWpxd1E9PSIsY25vbmNlPSJkNDFkOGNkOThmMDBiMjA0ZTk4MDA5OThlY2Y4NDI3ZSIsbmM9IjAwMDAwMDAxIixxb3A9ImF1dGgiLGRpZ2VzdC11cmk9InhtcHAvZGV2LmNoZXNzcGFyay5jb20iLHJlc3BvbnNlPSIxNGQ3NWE5YmU2MzdkOTdkOTM1YjU2Y2M4ZWZhODk4OSIsY2hhcnNldD0idXRmLTgi</response></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        self.failUnless(e[0]=="<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InRvZnUiLHJlYWxtPSJkZXYuY2hlc3NwYXJrLmNvbSIsbm9uY2U9Ik5SaW5HQkNaWjg0U09Ea1BzMWpxd1E9PSIsY25vbmNlPSJkNDFkOGNkOThmMDBiMjA0ZTk4MDA5OThlY2Y4NDI3ZSIsbmM9IjAwMDAwMDAxIixxb3A9ImF1dGgiLGRpZ2VzdC11cmk9InhtcHAvZGV2LmNoZXNzcGFyay5jb20iLHJlc3BvbnNlPSIxNGQ3NWE5YmU2MzdkOTdkOTM1YjU2Y2M4ZWZhODk4OSIsY2hhcnNldD0idXRmLTgi</response>", 'Invalid xml')
示例#5
0
 def testPrefixes(self):
     XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/></body>"""
     hp = HttpbParse()
     b, e = hp.parse(XML)
     self.failUnless(
         e[0] ==
         "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>",
         'invalid xml')
示例#6
0
    def testPrefixes(self):
        XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        self.failUnless(e[0]==u"<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>", 'invalid xml')
示例#7
0
    def testParseEscapedAttribute(self):
        XML = """<body rid='4019888743' xmlns='http://jabber.org/protocol/httpbind' sid='948972a64d524f862107cdbd748d1d16'><presence from='*****@*****.**' to='[email protected]/D&apos;Artagnan Longfellow'/></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)
        ex = "<presence from='*****@*****.**' to='[email protected]/D&apos;Artagnan Longfellow'/>"
        self.assertXMLEqual(e[0], ex)
示例#8
0
    def testParseEscapedAttribute(self):
        XML = """<body rid='4019888743' xmlns='http://jabber.org/protocol/httpbind' sid='948972a64d524f862107cdbd748d1d16'><presence from='*****@*****.**' to='[email protected]/D&apos;Artagnan Longfellow'/></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        ex = "<presence from='*****@*****.**' to='[email protected]/D&apos;Artagnan Longfellow'/>"
        self.assertEquals(e[0], ex)
示例#9
0
    def testPrefixesLang(self):
        XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><message xml:lang='fr' to='*****@*****.**'><body>test</body></message></body>"""

        hp = HttpbParse()
        b, e = hp.parse(XML)
        self.failUnlessEqual(
            e[0],
            "<message xml:lang='fr' to='*****@*****.**'><body>test</body></message>",
            'XML does not match {}'.format(e[0]))
示例#10
0
    def testPrefixesLang(self):
        XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><message xml:lang='fr' to='*****@*****.**'><body>test</body></message></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)
        self.failUnless(
            e[0] ==
            u"<message to='*****@*****.**' xml:lang='fr'><body>test</body></message>",
            'invalid xml')
示例#11
0
    def testParse(self):
        XML = """
 <body rid='4019888743' xmlns='http://jabber.org/protocol/httpbind' sid='948972a64d524f862107cdbd748d1d16'><iq id='980:getprefs' type='get'><query xmlns='jabber:iq:private'><preferences xmlns='http://chesspark.com/xml/chesspark-01'/></query></iq><iq id='981:getallignorelists' type='get'><query xmlns='jabber:iq:privacy'/></iq></body>
"""
        hp = HttpbParse()

        b, e = hp.parse(XML)

        # need tests here
        self.failUnless(e[0]=="<iq id='980:getprefs' type='get'><query xmlns='jabber:iq:private'><preferences xmlns='http://chesspark.com/xml/chesspark-01'/></query></iq>", 'invalid xml')
        self.failUnless(e[1]=="<iq id='981:getallignorelists' type='get'><query xmlns='jabber:iq:privacy'/></iq>", 'invalid xml')
示例#12
0
    def testCDATA(self):
        XML = """<body rid='3116008962' xmlns='http://jabber.org/protocol/httpbind' sid='88be95e7ebbd8c12465e311ce73fb8ac'><response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InRvZnUiLHJlYWxtPSJkZXYuY2hlc3NwYXJrLmNvbSIsbm9uY2U9Ik5SaW5HQkNaWjg0U09Ea1BzMWpxd1E9PSIsY25vbmNlPSJkNDFkOGNkOThmMDBiMjA0ZTk4MDA5OThlY2Y4NDI3ZSIsbmM9IjAwMDAwMDAxIixxb3A9ImF1dGgiLGRpZ2VzdC11cmk9InhtcHAvZGV2LmNoZXNzcGFyay5jb20iLHJlc3BvbnNlPSIxNGQ3NWE5YmU2MzdkOTdkOTM1YjU2Y2M4ZWZhODk4OSIsY2hhcnNldD0idXRmLTgi</response></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        self.failUnless(
            e[0] ==
            "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9InRvZnUiLHJlYWxtPSJkZXYuY2hlc3NwYXJrLmNvbSIsbm9uY2U9Ik5SaW5HQkNaWjg0U09Ea1BzMWpxd1E9PSIsY25vbmNlPSJkNDFkOGNkOThmMDBiMjA0ZTk4MDA5OThlY2Y4NDI3ZSIsbmM9IjAwMDAwMDAxIixxb3A9ImF1dGgiLGRpZ2VzdC11cmk9InhtcHAvZGV2LmNoZXNzcGFyay5jb20iLHJlc3BvbnNlPSIxNGQ3NWE5YmU2MzdkOTdkOTM1YjU2Y2M4ZWZhODk4OSIsY2hhcnNldD0idXRmLTgi</response>",
            'Invalid xml')
示例#13
0
    def testGtBug(self):
        XML = """ <body rid='1445008480' xmlns='http://jabber.org/protocol/httpbind' sid='1f2f8585f41e2dacf1f1f0ad83f8833d'><presence type='unavailable' from='[email protected]/cpc' to='[email protected]/[email protected]'/><iq id='10059:enablepush' to='search.chesspark.com' type='set'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq><iq id='10060:enablepush' to='search.chesspark.com' type='set'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq></body>
"""
        hp = HttpbParse()

        b, e = hp.parse(XML)

        # need tests here
        self.failUnless(e[0]==u"<presence from='[email protected]/cpc' type='unavailable' to='[email protected]/[email protected]'/>",'invalid xml')
        self.failUnless(e[1]==u"<iq to='search.chesspark.com' type='set' id='10059:enablepush'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq>", 'invalid xml')
        self.failUnless(e[2]==u"<iq to='search.chesspark.com' type='set' id='10060:enablepush'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq>", 'invalid xml')
示例#14
0
    def testEscapedCDATA(self):
        XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><message><body>&gt; </body></message></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        XML = """ <body rid='1484853516' xmlns='http://jabber.org/protocol/httpbind' sid='4dc131a03346bf94b0d2565dda02de36'><message to='*****@*****.**' from='[email protected]/cpc' type='groupchat' id='2900'><body xmlns='jabber:client'>i type &gt; and i see &gt;&gt;&gt;</body></message></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        self.failUnless(e[0]=="<message to='*****@*****.**' from='[email protected]/cpc' type='groupchat' id='2900'><body xmlns='jabber:client'>i type &gt; and i see &gt;&gt;&gt;</body></message>", 'Invalid Xml')
示例#15
0
    def testParse(self):
        XML = """
 <body rid='4019888743' xmlns='http://jabber.org/protocol/httpbind' sid='948972a64d524f862107cdbd748d1d16'><iq id='980:getprefs' type='get'><query xmlns='jabber:iq:private'><preferences xmlns='http://chesspark.com/xml/chesspark-01'/></query></iq><iq id='981:getallignorelists' type='get'><query xmlns='jabber:iq:privacy'/></iq></body>
"""
        hp = HttpbParse()

        b, e = hp.parse(XML)

        # need tests here
        self.assertXMLEqual(
            e[0],
            "<iq type='get' id='980:getprefs'><query xmlns='jabber:iq:private'><preferences xmlns='http://chesspark.com/xml/chesspark-01'/></query></iq>"
        )
        self.assertXMLEqual(
            e[1],
            "<iq type='get' id='981:getallignorelists'><query xmlns='jabber:iq:privacy'/></iq>"
        )
示例#16
0
    def sendBody(self, b):
        """
        Send the body
        """
        parser = HttpbParse(use_t=True)
        data = ''
        # start new session
        bxml = b.toXml()

        conn = httplib.HTTPConnection(self.host+":"+self.port)
        conn.request("POST", self.url, bxml, self.headers)
        response = conn.getresponse()
        if response.status == 200:
            data = response.read()
        conn.close()

        return parser.parse(data)
示例#17
0
    def sendBody(self, body):
        """Send the body.
        """

        parser = HttpbParse(True)

        # start new session
        conn = httplib.HTTPConnection(self.bosh_service.netloc)
        conn.request("POST", self.bosh_service.path, 
		     body.toXml(), self.headers)

        response = conn.getresponse()
	data = ''
        if response.status == 200:
            data = response.read()
        conn.close()

        return parser.parse(data)
示例#18
0
    def sendBody(self, body):
        """Send the body.
        """

        parser = HttpbParse(True)

        # start new session
        conn = httplib.HTTPConnection(self.bosh_service.netloc)
        conn.request("POST", self.bosh_service.path, 
		     body.toXml(), self.headers)

        response = conn.getresponse()
	data = ''
        if response.status == 200:
            data = response.read()
        conn.close()

        return parser.parse(data)
示例#19
0
文件: prebind.py 项目: hinesmr/mica
    def sendBody(self, body):
        parser = HttpbParse(True)

        mdebug("Body: " + str(body.toXml() + " to " + self.bosh_service.netloc + " " + self.bosh_service.path + " " + str(self.bosh_service.scheme)))
        if self.bosh_service.scheme == "https" : 
            conn = http_client.HTTPSConnection(self.bosh_service.netloc, timeout = 10)
        else :
            conn = http_client.HTTPConnection(self.bosh_service.netloc, timeout = 10)
        conn.request("POST", self.bosh_service.path, body.toXml(), self.headers)
        response = conn.getresponse()
        data = ''
        if response.status == 200:
            data = response.read()
            mdebug("Response: " + str(data))
        else :
            mdebug("Error: " + str(response.status))
        conn.close()

        return parser.parse(data)
示例#20
0
 def parseResponse(self, contents, protocol):
     self.client = protocol
     hp = HttpbParse(True)
     
     try:
         body_tag,elements = hp.parse(contents)
     except:
         raise
     else:
         if body_tag.hasAttribute('type') and body_tag['type'] == 'terminate':
             if self.deferred.called:
                 return defer.fail((body_tag,elements))
             else:            
                 self.deferred.errback((body_tag,elements))
             return
         if self.deferred.called:
             return defer.succeed((body_tag,elements))
         else:            
             self.deferred.callback((body_tag,elements))
示例#21
0
    def testGtBug(self):
        XML = """ <body rid='1445008480' xmlns='http://jabber.org/protocol/httpbind' sid='1f2f8585f41e2dacf1f1f0ad83f8833d'><presence type='unavailable' from='[email protected]/cpc' to='[email protected]/[email protected]'/><iq id='10059:enablepush' to='search.chesspark.com' type='set'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq><iq id='10060:enablepush' to='search.chesspark.com' type='set'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq></body>
"""
        hp = HttpbParse()

        b, e = hp.parse(XML)

        # need tests here
        self.assertXMLEqual(
            e[0],
            "<presence from='[email protected]/cpc' type='unavailable' to='[email protected]/[email protected]'/>"
        )
        self.assertXMLEqual(
            e[1],
            "<iq to='search.chesspark.com' type='set' id='10059:enablepush'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq>"
        )
        self.assertXMLEqual(
            e[2],
            "<iq to='search.chesspark.com' type='set' id='10060:enablepush'><search xmlns='http://onlinegamegroup.com/xml/chesspark-01' node='play'><filter><relative-rating>500</relative-rating><time-control-range name='speed'/></filter></search></iq>"
        )
示例#22
0
    def parseResponse(self, contents, protocol):
        self.client = protocol
        hp = HttpbParse(True)

        try:
            body_tag, elements = hp.parse(contents)
        except:
            raise
        else:
            if body_tag.hasAttribute(
                    'type') and body_tag['type'] == 'terminate':
                if self.deferred.called:
                    return defer.fail((body_tag, elements))
                else:
                    self.deferred.errback((body_tag, elements))
                return
            if self.deferred.called:
                return defer.succeed((body_tag, elements))
            else:
                self.deferred.callback((body_tag, elements))
示例#23
0
 def parseResponse(self, contents, protocol):
     self.client = protocol
     hp = HttpbParse(True)
     try:
         body_tag, elements = hp.parse(contents)
     except Exception:
         raise
     else:
         if body_tag.hasAttribute('type') \
          and body_tag['type'] == 'terminate':
             nte = HTTPBNetworkTerminated(body_tag, elements)
             error = failure.Failure(nte)
             if self.deferred.called:
                 return defer.fail(error)
             else:
                 self.deferred.errback(error)
             return
         if self.deferred.called:
             return defer.succeed((body_tag, elements))
         else:
             self.deferred.callback((body_tag, elements))
示例#24
0
    def testEscapedCDATA(self):
        XML = """<body rid='384852951' xmlns='http://jabber.org/protocol/httpbind' sid='e46501b24abd334c062598498a8e02ba'><message><body>&gt; </body></message></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        XML = """ <body rid='1484853516' xmlns='http://jabber.org/protocol/httpbind' sid='4dc131a03346bf94b0d2565dda02de36'><message to='*****@*****.**' from='[email protected]/cpc' type='groupchat' id='2900'><body xmlns='jabber:client'>i type &gt; and i see &gt;&gt;&gt;</body></message></body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)
        self.assertXMLEqual(
            e[0],
            "<message to='*****@*****.**' from='[email protected]/cpc' id='2900' type='groupchat'><body xmlns='jabber:client'>i type &gt; and i see &gt;&gt;&gt;</body></message>"
        )
示例#25
0
    def assertXMLEqual(self, expected_str, elem_str):
        hp = HttpbParse(use_t=True)
        _, ex = hp.parse("<body>{}</body>".format(expected_str))
        hp._reset()
        _, e = hp.parse("<body>{}</body>".format(elem_str))

        self.assertTrue(len(e) > 0)
        self.assertEqual(len(ex), len(e))

        def assert_equal_elements(e1, e2):
            if isinstance(e1, str):
                self.assertEqual(e1, e2)
            else:
                self.assertEqual(e1.name, e2.name)
                for k, v in e1.attributes.items():
                    self.assertEqual(v, e2.attributes[k])
                for i, c in enumerate(e1.children):
                    assert_equal_elements(c, e2.children[i])

        assert_equal_elements(ex[0], e[0])
示例#26
0
    def testTime(self):
        XML = """
 <body rid='4019888743' xmlns='http://jabber.org/protocol/httpbind' sid='948972a64d524f862107cdbd748d1d16'><iq id='980:getprefs' type='get'><query xmlns='jabber:iq:private'><preferences xmlns='http://chesspark.com/xml/chesspark-01'/></query></iq><iq id='981:getallignorelists' type='get'><query xmlns='jabber:iq:privacy'/></iq><test/><testing><ha/></testing></body>
"""
        t = time.time()

        for i in range(0, 10000):
            hp = HttpbParse(use_t=True)
            b, elems = hp.parse(XML)
            for e in elems:
                x = e.toXml()
        td = time.time() - t

        t = time.time()
        for i in range(0, 10000):
            hp = HttpbParse()
            b, elems = hp.parse(XML)
            for e in elems:
                if type(u'') == type(e):
                    x = e
        ntd = time.time() - t
        self.failUnless(td > ntd, 'Not faster')
示例#27
0
    def testPrefsCdata(self):

        XML = """<body rid='4017760695' xmlns='http://jabber.org/protocol/httpbind' sid='74a730628186b053a953999bc2ae7dba'>
      <iq id='6161:setprefs' type='set' xmlns='jabber:client'>
        <query xmlns='jabber:iq:private'>
          <preferences xmlns='http://chesspark.com/xml/chesspark-01'>
            <statuses>
              <away>test2</away>
              <available>test1</available>
            </statuses>
            <favorite-channels>
              <channel jid='*****@*****.**' autojoin='no'/>
              <channel jid='*****@*****.**' autojoin='no'/>
              <channel jid='*****@*****.**' autojoin='no'/>
            </favorite-channels>
            <time-controls/>
            <searchfilters>
              <filter node='play'>
                <variant name='standard'/>
              </filter>
              <filter open='yes' node='watch'>
                <computer/>
              </filter>
              <filter node='adjourned'>
                <computer/>
              </filter>
              <filter node='myads'>
                <computer/>
              </filter>
            </searchfilters>
            <loginrooms>
              <room>[email protected]</room>
            </loginrooms>
            <noinitialroster/>
            <boardsize size='61'/>
            <volume setting='100'/>
            <hidewelcomedialog/>
            <showoffline/>
            <showavatars/>
            <showmucpresenceinchat/>
            <hideparticipants/>
            <newlineonshift/>
            <nochatnotify/>
            <no-gameboard-autoresize/>
            <messagewhenplaying/>
            <hidegamefinderhelp/>
            <hidewarningondisconnect/>
            <disablesounds/>
            <nogamesearchonlogin/>
          </preferences>
        </query>
      </iq>
    </body>"""

        hp = HttpbParse()

        b, e = hp.parse(XML)

        expected = """<iq xmlns='jabber:client' id='6161:setprefs' type='set'>
        <query xmlns='jabber:iq:private'>
          <preferences xmlns='http://chesspark.com/xml/chesspark-01'>
            <statuses>
              <away>test2</away>
              <available>test1</available>
            </statuses>
            <favorite-channels>
              <channel jid='*****@*****.**' autojoin='no'/>
              <channel jid='*****@*****.**' autojoin='no'/>
              <channel jid='*****@*****.**' autojoin='no'/>
            </favorite-channels>
            <time-controls/>
            <searchfilters>
              <filter node='play'>
                <variant name='standard'/>
              </filter>
              <filter node='watch' open='yes'>
                <computer/>
              </filter>
              <filter node='adjourned'>
                <computer/>
              </filter>
              <filter node='myads'>
                <computer/>
              </filter>
            </searchfilters>
            <loginrooms>
              <room>[email protected]</room>
            </loginrooms>
            <noinitialroster/>
            <boardsize size='61'/>
            <volume setting='100'/>
            <hidewelcomedialog/>
            <showoffline/>
            <showavatars/>
            <showmucpresenceinchat/>
            <hideparticipants/>
            <newlineonshift/>
            <nochatnotify/>
            <no-gameboard-autoresize/>
            <messagewhenplaying/>
            <hidegamefinderhelp/>
            <hidewarningondisconnect/>
            <disablesounds/>
            <nogamesearchonlogin/>
          </preferences>
        </query>
      </iq>"""

        self.assertXMLEqual(expected, e[0])