Simplified SleekTest.
* check_stanza does not require stanza_class parameter. Introspection! * check_message, check_iq, and check_presence removed -- use check instead. * stream_send_stanza, stream_send_message, stream_send_iq, and stream_send_presence removed -- use send instead. * Use recv instead of recv_message, recv_presence, etc. * check_jid instead of check_JID * stream_start may accept multi=True to return a new SleekTest instance for testing multiple streams at once.
This commit is contained in:
@@ -20,9 +20,9 @@ class TestLiveStream(SleekTest):
|
||||
|
||||
# Use sid=None to ignore any id sent by the server since
|
||||
# we can't know it in advance.
|
||||
self.stream_recv_header(sfrom='localhost', sid=None)
|
||||
self.stream_send_header(sto='localhost')
|
||||
self.stream_recv_feature("""
|
||||
self.recv_header(sfrom='localhost', sid=None)
|
||||
self.send_header(sto='localhost')
|
||||
self.recv_feature("""
|
||||
<stream:features>
|
||||
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
|
||||
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
|
||||
@@ -35,15 +35,15 @@ class TestLiveStream(SleekTest):
|
||||
<register xmlns="http://jabber.org/features/iq-register" />
|
||||
</stream:features>
|
||||
""")
|
||||
self.stream_send_feature("""
|
||||
self.send_feature("""
|
||||
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
|
||||
""")
|
||||
self.stream_recv_feature("""
|
||||
self.recv_feature("""
|
||||
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
|
||||
""")
|
||||
self.stream_send_header(sto='localhost')
|
||||
self.stream_recv_header(sfrom='localhost', sid=None)
|
||||
self.stream_recv_feature("""
|
||||
self.send_header(sto='localhost')
|
||||
self.recv_header(sfrom='localhost', sid=None)
|
||||
self.recv_feature("""
|
||||
<stream:features>
|
||||
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
|
||||
<mechanism>DIGEST-MD5</mechanism>
|
||||
@@ -56,16 +56,16 @@ class TestLiveStream(SleekTest):
|
||||
<register xmlns="http://jabber.org/features/iq-register" />
|
||||
</stream:features>
|
||||
""")
|
||||
self.stream_send_feature("""
|
||||
self.send_feature("""
|
||||
<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl"
|
||||
mechanism="PLAIN">AHVzZXIAdXNlcg==</auth>
|
||||
""")
|
||||
self.stream_recv_feature("""
|
||||
self.recv_feature("""
|
||||
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
|
||||
""")
|
||||
self.stream_send_header(sto='localhost')
|
||||
self.stream_recv_header(sfrom='localhost', sid=None)
|
||||
self.stream_recv_feature("""
|
||||
self.send_header(sto='localhost')
|
||||
self.recv_header(sfrom='localhost', sid=None)
|
||||
self.recv_feature("""
|
||||
<stream:features>
|
||||
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
|
||||
<session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
|
||||
@@ -77,16 +77,16 @@ class TestLiveStream(SleekTest):
|
||||
</stream:features>
|
||||
""")
|
||||
|
||||
# Should really use stream_send_iq, but our Iq stanza objects
|
||||
# Should really use send, but our Iq stanza objects
|
||||
# can't handle bind element payloads yet.
|
||||
self.stream_send_feature("""
|
||||
self.send_feature("""
|
||||
<iq type="set" id="1">
|
||||
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
|
||||
<resource>test</resource>
|
||||
</bind>
|
||||
</iq>
|
||||
""")
|
||||
self.stream_recv_feature("""
|
||||
self.recv_feature("""
|
||||
<iq type="result" id="1">
|
||||
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
|
||||
<jid>user@localhost/test</jid>
|
||||
|
@@ -8,7 +8,7 @@ class TestJIDClass(SleekTest):
|
||||
|
||||
def testJIDFromFull(self):
|
||||
"""Test using JID of the form 'user@server/resource/with/slashes'."""
|
||||
self.check_JID(JID('user@someserver/some/resource'),
|
||||
self.check_jid(JID('user@someserver/some/resource'),
|
||||
'user',
|
||||
'someserver',
|
||||
'some/resource',
|
||||
@@ -22,7 +22,7 @@ class TestJIDClass(SleekTest):
|
||||
j.user = 'user'
|
||||
j.domain = 'someserver'
|
||||
j.resource = 'some/resource'
|
||||
self.check_JID(j,
|
||||
self.check_jid(j,
|
||||
'user',
|
||||
'someserver',
|
||||
'some/resource',
|
||||
@@ -34,15 +34,15 @@ class TestJIDClass(SleekTest):
|
||||
"""Test changing JID using aliases for domain."""
|
||||
j = JID('user@someserver/resource')
|
||||
j.server = 'anotherserver'
|
||||
self.check_JID(j, domain='anotherserver')
|
||||
self.check_jid(j, domain='anotherserver')
|
||||
j.host = 'yetanother'
|
||||
self.check_JID(j, domain='yetanother')
|
||||
self.check_jid(j, domain='yetanother')
|
||||
|
||||
def testJIDSetFullWithUser(self):
|
||||
"""Test setting the full JID with a user portion."""
|
||||
j = JID('user@domain/resource')
|
||||
j.full = 'otheruser@otherdomain/otherresource'
|
||||
self.check_JID(j,
|
||||
self.check_jid(j,
|
||||
'otheruser',
|
||||
'otherdomain',
|
||||
'otherresource',
|
||||
@@ -57,7 +57,7 @@ class TestJIDClass(SleekTest):
|
||||
"""
|
||||
j = JID('user@domain/resource')
|
||||
j.full = 'otherdomain/otherresource'
|
||||
self.check_JID(j,
|
||||
self.check_jid(j,
|
||||
'',
|
||||
'otherdomain',
|
||||
'otherresource',
|
||||
@@ -72,7 +72,7 @@ class TestJIDClass(SleekTest):
|
||||
"""
|
||||
j = JID('user@domain/resource')
|
||||
j.full = 'otherdomain'
|
||||
self.check_JID(j,
|
||||
self.check_jid(j,
|
||||
'',
|
||||
'otherdomain',
|
||||
'',
|
||||
@@ -84,7 +84,7 @@ class TestJIDClass(SleekTest):
|
||||
"""Test setting the bare JID with a user."""
|
||||
j = JID('user@domain/resource')
|
||||
j.bare = 'otheruser@otherdomain'
|
||||
self.check_JID(j,
|
||||
self.check_jid(j,
|
||||
'otheruser',
|
||||
'otherdomain',
|
||||
'resource',
|
||||
@@ -96,7 +96,7 @@ class TestJIDClass(SleekTest):
|
||||
"""Test setting the bare JID without a user."""
|
||||
j = JID('user@domain/resource')
|
||||
j.bare = 'otherdomain'
|
||||
self.check_JID(j,
|
||||
self.check_jid(j,
|
||||
'',
|
||||
'otherdomain',
|
||||
'resource',
|
||||
@@ -106,7 +106,7 @@ class TestJIDClass(SleekTest):
|
||||
|
||||
def testJIDNoResource(self):
|
||||
"""Test using JID of the form 'user@domain'."""
|
||||
self.check_JID(JID('user@someserver'),
|
||||
self.check_jid(JID('user@someserver'),
|
||||
'user',
|
||||
'someserver',
|
||||
'',
|
||||
@@ -116,7 +116,7 @@ class TestJIDClass(SleekTest):
|
||||
|
||||
def testJIDNoUser(self):
|
||||
"""Test JID of the form 'component.domain.tld'."""
|
||||
self.check_JID(JID('component.someserver'),
|
||||
self.check_jid(JID('component.someserver'),
|
||||
'',
|
||||
'component.someserver',
|
||||
'',
|
||||
|
@@ -27,7 +27,7 @@ class TestElementBase(SleekTest):
|
||||
namespace = "test"
|
||||
|
||||
stanza = TestStanza()
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="test">
|
||||
<bar>
|
||||
<baz />
|
||||
@@ -117,7 +117,7 @@ class TestElementBase(SleekTest):
|
||||
'baz': ''}]}
|
||||
stanza.setStanzaValues(values)
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" bar="a">
|
||||
<pluginfoo baz="b" />
|
||||
<pluginfoo2 bar="d" baz="e" />
|
||||
@@ -198,7 +198,7 @@ class TestElementBase(SleekTest):
|
||||
stanza['qux'] = 'overridden'
|
||||
stanza['foobar'] = 'plugin'
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" bar="attribute!">
|
||||
<baz>element!</baz>
|
||||
<foobar foobar="plugin" />
|
||||
@@ -231,7 +231,7 @@ class TestElementBase(SleekTest):
|
||||
stanza['qux'] = 'c'
|
||||
stanza['foobar']['foobar'] = 'd'
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" baz="b" qux="c">
|
||||
<bar>a</bar>
|
||||
<foobar foobar="d" />
|
||||
@@ -243,7 +243,7 @@ class TestElementBase(SleekTest):
|
||||
del stanza['qux']
|
||||
del stanza['foobar']
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" qux="c" />
|
||||
""")
|
||||
|
||||
@@ -257,7 +257,7 @@ class TestElementBase(SleekTest):
|
||||
|
||||
stanza = TestStanza()
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" />
|
||||
""")
|
||||
|
||||
@@ -267,7 +267,7 @@ class TestElementBase(SleekTest):
|
||||
stanza._set_attr('bar', 'a')
|
||||
stanza._set_attr('baz', 'b')
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" bar="a" baz="b" />
|
||||
""")
|
||||
|
||||
@@ -277,7 +277,7 @@ class TestElementBase(SleekTest):
|
||||
stanza._set_attr('bar', None)
|
||||
stanza._del_attr('baz')
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo" />
|
||||
""")
|
||||
|
||||
@@ -307,7 +307,7 @@ class TestElementBase(SleekTest):
|
||||
"Default _get_sub_text value incorrect.")
|
||||
|
||||
stanza['bar'] = 'found'
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<wrapper>
|
||||
<bar>found</bar>
|
||||
@@ -340,7 +340,7 @@ class TestElementBase(SleekTest):
|
||||
stanza = TestStanza()
|
||||
stanza['bar'] = 'a'
|
||||
stanza['baz'] = 'b'
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<wrapper>
|
||||
<bar>a</bar>
|
||||
@@ -349,7 +349,7 @@ class TestElementBase(SleekTest):
|
||||
</foo>
|
||||
""")
|
||||
stanza._set_sub_text('wrapper/bar', text='', keep=True)
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<wrapper>
|
||||
<bar />
|
||||
@@ -360,7 +360,7 @@ class TestElementBase(SleekTest):
|
||||
|
||||
stanza['bar'] = 'a'
|
||||
stanza._set_sub_text('wrapper/bar', text='')
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<wrapper>
|
||||
<baz>b</baz>
|
||||
@@ -398,7 +398,7 @@ class TestElementBase(SleekTest):
|
||||
stanza['bar'] = 'a'
|
||||
stanza['baz'] = 'b'
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<path>
|
||||
<to>
|
||||
@@ -416,7 +416,7 @@ class TestElementBase(SleekTest):
|
||||
del stanza['bar']
|
||||
del stanza['baz']
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<path>
|
||||
<to>
|
||||
@@ -432,7 +432,7 @@ class TestElementBase(SleekTest):
|
||||
|
||||
stanza._del_sub('path/to/only/bar', all=True)
|
||||
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<path>
|
||||
<to>
|
||||
@@ -603,7 +603,7 @@ class TestElementBase(SleekTest):
|
||||
"Incorrect empty stanza size.")
|
||||
|
||||
stanza.append(substanza1)
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<foobar qux="a" />
|
||||
</foo>
|
||||
@@ -612,7 +612,7 @@ class TestElementBase(SleekTest):
|
||||
"Incorrect stanza size with 1 substanza.")
|
||||
|
||||
stanza.append(substanza2)
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<foobar qux="a" />
|
||||
<foobar qux="b" />
|
||||
@@ -623,7 +623,7 @@ class TestElementBase(SleekTest):
|
||||
|
||||
# Test popping substanzas
|
||||
stanza.pop(0)
|
||||
self.check_stanza(TestStanza, stanza, """
|
||||
self.check(stanza, """
|
||||
<foo xmlns="foo">
|
||||
<foobar qux="b" />
|
||||
</foo>
|
||||
|
@@ -7,7 +7,7 @@ class TestErrorStanzas(SleekTest):
|
||||
"""Test setting initial values in error stanza."""
|
||||
msg = self.Message()
|
||||
msg.enable('error')
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
|
||||
@@ -20,7 +20,7 @@ class TestErrorStanzas(SleekTest):
|
||||
msg = self.Message()
|
||||
msg['error']['condition'] = 'item-not-found'
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
|
||||
@@ -32,7 +32,7 @@ class TestErrorStanzas(SleekTest):
|
||||
|
||||
msg['error']['condition'] = 'resource-constraint'
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<resource-constraint xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
|
||||
@@ -48,7 +48,7 @@ class TestErrorStanzas(SleekTest):
|
||||
|
||||
del msg['error']['condition']
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Error!</text>
|
||||
@@ -64,7 +64,7 @@ class TestErrorStanzas(SleekTest):
|
||||
|
||||
del msg['error']['text']
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
|
||||
|
@@ -18,7 +18,7 @@ class TestGmail(SleekTest):
|
||||
iq['gmail']['newer-than-time'] = '1140638252542'
|
||||
iq['gmail']['newer-than-tid'] = '11134623426430234'
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq type="get">
|
||||
<query xmlns="google:mail:notify"
|
||||
newer-than-time="1140638252542"
|
||||
|
@@ -11,7 +11,7 @@ class TestIqStanzas(SleekTest):
|
||||
def testSetup(self):
|
||||
"""Test initializing default Iq values."""
|
||||
iq = self.Iq()
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0" />
|
||||
""")
|
||||
|
||||
@@ -19,7 +19,7 @@ class TestIqStanzas(SleekTest):
|
||||
"""Test setting Iq stanza payload."""
|
||||
iq = self.Iq()
|
||||
iq.setPayload(ET.Element('{test}tester'))
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<tester xmlns="test" />
|
||||
</iq>
|
||||
@@ -29,7 +29,7 @@ class TestIqStanzas(SleekTest):
|
||||
def testUnhandled(self):
|
||||
"""Test behavior for Iq.unhandled."""
|
||||
self.stream_start()
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<iq id="test" type="get">
|
||||
<query xmlns="test" />
|
||||
</iq>
|
||||
@@ -40,7 +40,7 @@ class TestIqStanzas(SleekTest):
|
||||
iq['error']['condition'] = 'feature-not-implemented'
|
||||
iq['error']['text'] = 'No handlers registered for this request.'
|
||||
|
||||
self.stream_send_iq(iq, """
|
||||
self.send(iq, """
|
||||
<iq id="test" type="error">
|
||||
<error type="cancel">
|
||||
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
|
||||
@@ -56,14 +56,14 @@ class TestIqStanzas(SleekTest):
|
||||
iq = self.Iq()
|
||||
|
||||
iq['query'] = 'query_ns'
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="query_ns" />
|
||||
</iq>
|
||||
""")
|
||||
|
||||
iq['query'] = 'query_ns2'
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="query_ns2" />
|
||||
</iq>
|
||||
@@ -72,7 +72,7 @@ class TestIqStanzas(SleekTest):
|
||||
self.failUnless(iq['query'] == 'query_ns2', "Query namespace doesn't match")
|
||||
|
||||
del iq['query']
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0" />
|
||||
""")
|
||||
|
||||
@@ -83,7 +83,7 @@ class TestIqStanzas(SleekTest):
|
||||
iq['type'] = 'get'
|
||||
iq.reply()
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0" type="result" />
|
||||
""")
|
||||
|
||||
|
@@ -33,7 +33,7 @@ class TestMessageStanzas(SleekTest):
|
||||
p = ET.Element('{http://www.w3.org/1999/xhtml}p')
|
||||
p.text = "This is the htmlim message"
|
||||
msg['html']['body'] = p
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message to="fritzy@netflint.net/sleekxmpp" type="chat">
|
||||
<body>this is the plaintext message</body>
|
||||
<html xmlns="http://jabber.org/protocol/xhtml-im">
|
||||
@@ -47,7 +47,7 @@ class TestMessageStanzas(SleekTest):
|
||||
"Test message/nick/nick stanza."
|
||||
msg = self.Message()
|
||||
msg['nick']['nick'] = 'A nickname!'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<nick xmlns="http://jabber.org/nick/nick">A nickname!</nick>
|
||||
</message>
|
||||
|
@@ -8,26 +8,26 @@ class TestPresenceStanzas(SleekTest):
|
||||
"""Regression check presence['type'] = 'dnd' show value working"""
|
||||
p = self.Presence()
|
||||
p['type'] = 'dnd'
|
||||
self.check_presence(p, "<presence><show>dnd</show></presence>")
|
||||
self.check(p, "<presence><show>dnd</show></presence>")
|
||||
|
||||
def testPresenceType(self):
|
||||
"""Test manipulating presence['type']"""
|
||||
p = self.Presence()
|
||||
p['type'] = 'available'
|
||||
self.check_presence(p, "<presence />")
|
||||
self.check(p, "<presence />")
|
||||
self.failUnless(p['type'] == 'available',
|
||||
"Incorrect presence['type'] for type 'available': %s" % p['type'])
|
||||
|
||||
for showtype in ['away', 'chat', 'dnd', 'xa']:
|
||||
p['type'] = showtype
|
||||
self.check_presence(p, """
|
||||
self.check(p, """
|
||||
<presence><show>%s</show></presence>
|
||||
""" % showtype)
|
||||
self.failUnless(p['type'] == showtype,
|
||||
"Incorrect presence['type'] for type '%s'" % showtype)
|
||||
|
||||
p['type'] = None
|
||||
self.check_presence(p, "<presence />")
|
||||
self.check(p, "<presence />")
|
||||
|
||||
def testPresenceUnsolicitedOffline(self):
|
||||
"""
|
||||
@@ -56,7 +56,7 @@ class TestPresenceStanzas(SleekTest):
|
||||
"""Test presence/nick/nick stanza."""
|
||||
p = self.Presence()
|
||||
p['nick']['nick'] = 'A nickname!'
|
||||
self.check_presence(p, """
|
||||
self.check(p, """
|
||||
<presence>
|
||||
<nick xmlns="http://jabber.org/nick/nick">A nickname!</nick>
|
||||
</presence>
|
||||
|
@@ -16,7 +16,7 @@ class TestRosterStanzas(SleekTest):
|
||||
'name': 'Other User',
|
||||
'subscription': 'both',
|
||||
'groups': []}})
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq>
|
||||
<query xmlns="jabber:iq:roster">
|
||||
<item jid="user@example.com" name="User" subscription="both">
|
||||
@@ -74,7 +74,7 @@ class TestRosterStanzas(SleekTest):
|
||||
"""
|
||||
iq = self.Iq(ET.fromstring(xml_string))
|
||||
del iq['roster']['items']
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq>
|
||||
<query xmlns="jabber:iq:roster" />
|
||||
</iq>
|
||||
|
@@ -14,7 +14,7 @@ class TestDataForms(SleekTest):
|
||||
msg = self.Message()
|
||||
msg['form']['instructions'] = "Instructions\nSecond batch"
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<x xmlns="jabber:x:data" type="form">
|
||||
<instructions>Instructions</instructions>
|
||||
@@ -35,7 +35,7 @@ class TestDataForms(SleekTest):
|
||||
required=True,
|
||||
value='Some text!')
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<x xmlns="jabber:x:data" type="form">
|
||||
<field var="f1" type="text-single" label="Text">
|
||||
@@ -62,7 +62,7 @@ class TestDataForms(SleekTest):
|
||||
'value': 'cool'},
|
||||
{'label': 'Urgh!',
|
||||
'value': 'urgh'}]})]
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<x xmlns="jabber:x:data" type="form">
|
||||
<field var="f1" type="text-single" label="Username">
|
||||
@@ -99,7 +99,7 @@ class TestDataForms(SleekTest):
|
||||
form.setValues({'foo': 'Foo!',
|
||||
'bar': ['a', 'b']})
|
||||
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<x xmlns="jabber:x:data" type="form">
|
||||
<field var="foo" type="text-single">
|
||||
|
@@ -14,7 +14,7 @@ class TestDisco(SleekTest):
|
||||
iq['id'] = "0"
|
||||
iq['disco_info']['node'] = ''
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#info" />
|
||||
</iq>
|
||||
@@ -26,7 +26,7 @@ class TestDisco(SleekTest):
|
||||
iq['id'] = "0"
|
||||
iq['disco_info']['node'] = 'foo'
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#info" node="foo" />
|
||||
</iq>
|
||||
@@ -38,7 +38,7 @@ class TestDisco(SleekTest):
|
||||
iq['id'] = "0"
|
||||
iq['disco_items']['node'] = ''
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#items" />
|
||||
</iq>
|
||||
@@ -50,7 +50,7 @@ class TestDisco(SleekTest):
|
||||
iq['id'] = "0"
|
||||
iq['disco_items']['node'] = 'foo'
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#items" node="foo" />
|
||||
</iq>
|
||||
@@ -63,7 +63,7 @@ class TestDisco(SleekTest):
|
||||
iq['disco_info']['node'] = 'foo'
|
||||
iq['disco_info'].addIdentity('conference', 'text', 'Chatroom')
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#info" node="foo">
|
||||
<identity category="conference" type="text" name="Chatroom" />
|
||||
@@ -79,7 +79,7 @@ class TestDisco(SleekTest):
|
||||
iq['disco_info'].addFeature('foo')
|
||||
iq['disco_info'].addFeature('bar')
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#info" node="foo">
|
||||
<feature var="foo" />
|
||||
@@ -97,7 +97,7 @@ class TestDisco(SleekTest):
|
||||
iq['disco_items'].addItem('user@localhost', 'foo')
|
||||
iq['disco_items'].addItem('user@localhost', 'bar', 'Testing')
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<query xmlns="http://jabber.org/protocol/disco#items" node="foo">
|
||||
<item jid="user@localhost" />
|
||||
|
@@ -11,7 +11,7 @@ class TestAddresses(SleekTest):
|
||||
"""Testing adding extended stanza address."""
|
||||
msg = self.Message()
|
||||
msg['addresses'].addAddress(atype='to', jid='to@header1.org')
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<addresses xmlns="http://jabber.org/protocol/address">
|
||||
<address jid="to@header1.org" type="to" />
|
||||
@@ -23,7 +23,7 @@ class TestAddresses(SleekTest):
|
||||
msg['addresses'].addAddress(atype='replyto',
|
||||
jid='replyto@header1.org',
|
||||
desc='Reply address')
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<addresses xmlns="http://jabber.org/protocol/address">
|
||||
<address jid="replyto@header1.org" type="replyto" desc="Reply address" />
|
||||
@@ -53,14 +53,14 @@ class TestAddresses(SleekTest):
|
||||
'jid':'cc@header2.org'},
|
||||
{'type':'bcc',
|
||||
'jid':'bcc@header2.org'}])
|
||||
self.check_message(msg, xmlstring)
|
||||
self.check(msg, xmlstring)
|
||||
|
||||
msg = self.Message()
|
||||
msg['addresses']['replyto'] = [{'jid':'replyto@header1.org',
|
||||
'desc':'Reply address'}]
|
||||
msg['addresses']['cc'] = [{'jid':'cc@header2.org'}]
|
||||
msg['addresses']['bcc'] = [{'jid':'bcc@header2.org'}]
|
||||
self.check_message(msg, xmlstring)
|
||||
self.check(msg, xmlstring)
|
||||
|
||||
def testAddURI(self):
|
||||
"""Testing adding URI attribute to extended stanza address."""
|
||||
@@ -69,7 +69,7 @@ class TestAddresses(SleekTest):
|
||||
addr = msg['addresses'].addAddress(atype='to',
|
||||
jid='to@header1.org',
|
||||
node='foo')
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<addresses xmlns="http://jabber.org/protocol/address">
|
||||
<address node="foo" jid="to@header1.org" type="to" />
|
||||
@@ -78,7 +78,7 @@ class TestAddresses(SleekTest):
|
||||
""")
|
||||
|
||||
addr['uri'] = 'mailto:to@header2.org'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message>
|
||||
<addresses xmlns="http://jabber.org/protocol/address">
|
||||
<address type="to" uri="mailto:to@header2.org" />
|
||||
@@ -99,13 +99,13 @@ class TestAddresses(SleekTest):
|
||||
|
||||
msg = self.Message()
|
||||
addr = msg['addresses'].addAddress(jid='to@header1.org', atype='to')
|
||||
self.check_message(msg, xmlstring % '')
|
||||
self.check(msg, xmlstring % '')
|
||||
|
||||
addr['delivered'] = True
|
||||
self.check_message(msg, xmlstring % 'delivered="true"')
|
||||
self.check(msg, xmlstring % 'delivered="true"')
|
||||
|
||||
addr['delivered'] = False
|
||||
self.check_message(msg, xmlstring % '')
|
||||
self.check(msg, xmlstring % '')
|
||||
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestAddresses)
|
||||
|
@@ -16,7 +16,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
aff2['affiliation'] = 'publisher'
|
||||
iq['pubsub']['affiliations'].append(aff1)
|
||||
iq['pubsub']['affiliations'].append(aff2)
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<affiliations>
|
||||
@@ -38,7 +38,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
sub2['subscription'] = 'subscribed'
|
||||
iq['pubsub']['subscriptions'].append(sub1)
|
||||
iq['pubsub']['subscriptions'].append(sub2)
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<subscriptions>
|
||||
@@ -55,7 +55,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
iq['pubsub']['subscription']['node'] = 'testnode alsdkjfas'
|
||||
iq['pubsub']['subscription']['jid'] = "fritzy@netflint.net/sleekxmpp"
|
||||
iq['pubsub']['subscription']['subscription'] = 'unconfigured'
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<subscription node="testnode alsdkjfas" jid="fritzy@netflint.net/sleekxmpp" subscription="unconfigured">
|
||||
@@ -88,7 +88,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
item2['payload'] = payload2
|
||||
iq['pubsub']['items'].append(item)
|
||||
iq['pubsub']['items'].append(item2)
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<items node="crap">
|
||||
@@ -115,7 +115,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
iq['pubsub']['configure']['form'].addField('pubsub#title',
|
||||
ftype='text-single',
|
||||
value='This thing is awesome')
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<create node="mynode" />
|
||||
@@ -136,7 +136,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
iq['psstate']['item']= 'myitem'
|
||||
pl = ET.Element('{http://andyet.net/protocol/pubsubqueue}claimed')
|
||||
iq['psstate']['payload'] = pl
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<state xmlns="http://jabber.org/protocol/psstate" node="mynode" item="myitem">
|
||||
<claimed xmlns="http://andyet.net/protocol/pubsubqueue" />
|
||||
@@ -152,7 +152,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
iq['pubsub_owner']['default']['form'].addField('pubsub#title',
|
||||
ftype='text-single',
|
||||
value='This thing is awesome')
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
||||
<default node="mynode" type="leaf">
|
||||
@@ -176,7 +176,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
form = xep_0004.Form()
|
||||
form.addField('pubsub#title', ftype='text-single', value='this thing is awesome')
|
||||
iq['pubsub']['subscribe']['options']['options'] = form
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<subscribe node="cheese" jid="fritzy@netflint.net/sleekxmpp">
|
||||
@@ -214,7 +214,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
iq['pubsub']['publish'].append(item)
|
||||
iq['pubsub']['publish'].append(item2)
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<publish node="thingers">
|
||||
@@ -238,7 +238,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
"Testing iq/pubsub_owner/delete stanzas"
|
||||
iq = self.Iq()
|
||||
iq['pubsub_owner']['delete']['node'] = 'thingers'
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq id="0">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
||||
<delete node="thingers" />
|
||||
@@ -300,7 +300,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
'label': 'Deliver notification only to available users'}),
|
||||
])
|
||||
|
||||
self.check_iq(iq, """
|
||||
self.check(iq, """
|
||||
<iq to="pubsub.asdf" type="set" id="E" from="fritzy@asdf/87292ede-524d-4117-9076-d934ed3db8e7">
|
||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||
<create node="testnode2" />
|
||||
@@ -357,7 +357,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg['pubsub_event']['items'].append(item)
|
||||
msg['pubsub_event']['items']['node'] = 'cheese'
|
||||
msg['type'] = 'normal'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="normal">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<items node="cheese">
|
||||
@@ -383,7 +383,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg['pubsub_event']['items'].append(item2)
|
||||
msg['pubsub_event']['items']['node'] = 'cheese'
|
||||
msg['type'] = 'normal'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="normal">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<items node="cheese">
|
||||
@@ -415,7 +415,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg['pubsub_event']['items'].append(item2)
|
||||
msg['pubsub_event']['items']['node'] = 'cheese'
|
||||
msg['type'] = 'normal'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="normal">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<items node="cheese">
|
||||
@@ -435,7 +435,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg['pubsub_event']['collection']['associate']['node'] = 'cheese'
|
||||
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
|
||||
msg['type'] = 'headline'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="headline">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<collection node="cheeseburger">
|
||||
@@ -450,7 +450,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg['pubsub_event']['collection']['disassociate']['node'] = 'cheese'
|
||||
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
|
||||
msg['type'] = 'headline'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="headline">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<collection node="cheeseburger">
|
||||
@@ -467,7 +467,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
ftype='text-single',
|
||||
value='This thing is awesome')
|
||||
msg['type'] = 'headline'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="headline">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<configuration node="cheese">
|
||||
@@ -485,7 +485,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg = self.Message()
|
||||
msg['pubsub_event']['purge']['node'] = 'pickles'
|
||||
msg['type'] = 'headline'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="headline">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<purge node="pickles" />
|
||||
@@ -501,7 +501,7 @@ class TestPubsubStanzas(SleekTest):
|
||||
msg['pubsub_event']['subscription']['subscription'] = 'subscribed'
|
||||
msg['pubsub_event']['subscription']['expiry'] = 'presence'
|
||||
msg['type'] = 'headline'
|
||||
self.check_message(msg, """
|
||||
self.check(msg, """
|
||||
<message type="headline">
|
||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||
<subscription node="pickles" subid="aabb1122" jid="fritzy@netflint.net/test" subscription="subscribed" expiry="presence" />
|
||||
|
@@ -21,24 +21,24 @@ class TestChatStates(SleekTest):
|
||||
|
||||
msg = self.Message()
|
||||
msg['chat_state'].active()
|
||||
self.check_message(msg, xmlstring % 'active',
|
||||
self.check(msg, xmlstring % 'active',
|
||||
use_values=False)
|
||||
|
||||
msg['chat_state'].composing()
|
||||
self.check_message(msg, xmlstring % 'composing',
|
||||
self.check(msg, xmlstring % 'composing',
|
||||
use_values=False)
|
||||
|
||||
|
||||
msg['chat_state'].gone()
|
||||
self.check_message(msg, xmlstring % 'gone',
|
||||
self.check(msg, xmlstring % 'gone',
|
||||
use_values=False)
|
||||
|
||||
msg['chat_state'].inactive()
|
||||
self.check_message(msg, xmlstring % 'inactive',
|
||||
self.check(msg, xmlstring % 'inactive',
|
||||
use_values=False)
|
||||
|
||||
msg['chat_state'].paused()
|
||||
self.check_message(msg, xmlstring % 'paused',
|
||||
self.check(msg, xmlstring % 'paused',
|
||||
use_values=False)
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestChatStates)
|
||||
|
@@ -19,13 +19,13 @@ class TestStreamTester(SleekTest):
|
||||
|
||||
self.xmpp.add_event_handler('message', echo)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<message to="tester@localhost" from="user@localhost">
|
||||
<body>Hi!</body>
|
||||
</message>
|
||||
""")
|
||||
|
||||
self.stream_send_message("""
|
||||
self.send("""
|
||||
<message to="user@localhost">
|
||||
<body>Thanks for sending: Hi!</body>
|
||||
</message>
|
||||
@@ -40,13 +40,13 @@ class TestStreamTester(SleekTest):
|
||||
|
||||
self.xmpp.add_event_handler('message', echo)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<message to="tester.localhost" from="user@localhost">
|
||||
<body>Hi!</body>
|
||||
</message>
|
||||
""")
|
||||
|
||||
self.stream_send_message("""
|
||||
self.send("""
|
||||
<message to="user@localhost" from="tester.localhost">
|
||||
<body>Thanks for sending: Hi!</body>
|
||||
</message>
|
||||
@@ -55,6 +55,6 @@ class TestStreamTester(SleekTest):
|
||||
def testSendStreamHeader(self):
|
||||
"""Test that we can check a sent stream header."""
|
||||
self.stream_start(mode='client', skip=False)
|
||||
self.stream_send_header(sto='localhost')
|
||||
self.send_header(sto='localhost')
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamTester)
|
||||
|
@@ -26,13 +26,13 @@ class TestStreamExceptions(SleekTest):
|
||||
self.stream_start()
|
||||
self.xmpp.add_event_handler('message', message)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<message>
|
||||
<body>This is going to cause an error.</body>
|
||||
</message>
|
||||
""")
|
||||
|
||||
self.stream_send_message("""
|
||||
self.send("""
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<feature-not-implemented
|
||||
@@ -57,13 +57,13 @@ class TestStreamExceptions(SleekTest):
|
||||
self.xmpp.add_event_handler('message', message,
|
||||
threaded=True)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<message>
|
||||
<body>This is going to cause an error.</body>
|
||||
</message>
|
||||
""")
|
||||
|
||||
self.stream_send_message("""
|
||||
self.send("""
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<feature-not-implemented
|
||||
@@ -84,14 +84,14 @@ class TestStreamExceptions(SleekTest):
|
||||
self.stream_start()
|
||||
self.xmpp.add_event_handler('message', message)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<message>
|
||||
<body>This is going to cause an error.</body>
|
||||
</message>
|
||||
""")
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
self.stream_send_message("""
|
||||
self.send("""
|
||||
<message type="error">
|
||||
<error type="cancel">
|
||||
<undefined-condition
|
||||
|
@@ -30,11 +30,11 @@ class TestHandlers(SleekTest):
|
||||
|
||||
self.xmpp.registerHandler(callback)
|
||||
|
||||
self.stream_recv("""<tester xmlns="test" />""")
|
||||
self.recv("""<tester xmlns="test" />""")
|
||||
|
||||
msg = self.Message()
|
||||
msg['body'] = 'Success!'
|
||||
self.stream_send_message(msg)
|
||||
self.send(msg)
|
||||
|
||||
def testWaiter(self):
|
||||
"""Test using stream waiter handler."""
|
||||
@@ -55,7 +55,7 @@ class TestHandlers(SleekTest):
|
||||
self.xmpp.add_event_handler('message', waiter_handler, threaded=True)
|
||||
|
||||
# Send message to trigger waiter_handler
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<message>
|
||||
<body>Testing</body>
|
||||
</message>
|
||||
@@ -66,10 +66,10 @@ class TestHandlers(SleekTest):
|
||||
iq['id'] = 'test'
|
||||
iq['type'] = 'set'
|
||||
iq['query'] = 'test'
|
||||
self.stream_send_iq(iq)
|
||||
self.send(iq)
|
||||
|
||||
# Send the reply Iq
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<iq id="test" type="result">
|
||||
<query xmlns="test" />
|
||||
</iq>
|
||||
@@ -78,7 +78,7 @@ class TestHandlers(SleekTest):
|
||||
# Check that waiter_handler received the reply
|
||||
msg = self.Message()
|
||||
msg['body'] = 'Successful: test'
|
||||
self.stream_send_message(msg)
|
||||
self.send(msg)
|
||||
|
||||
def testWaiterTimeout(self):
|
||||
"""Test that waiter handler is removed after timeout."""
|
||||
@@ -93,14 +93,14 @@ class TestHandlers(SleekTest):
|
||||
self.xmpp.add_event_handler('message', waiter_handler, threaded=True)
|
||||
|
||||
# Start test by triggerig waiter_handler
|
||||
self.stream_recv("""<message><body>Start Test</body></message>""")
|
||||
self.recv("""<message><body>Start Test</body></message>""")
|
||||
|
||||
# Check that Iq was sent to trigger start of timeout period
|
||||
iq = self.Iq()
|
||||
iq['id'] = 'test2'
|
||||
iq['type'] = 'set'
|
||||
iq['query'] = 'test2'
|
||||
self.stream_send_iq(iq)
|
||||
self.send(iq)
|
||||
|
||||
# Check that the waiter is no longer registered
|
||||
waiter_exists = self.xmpp.removeHandler('IqWait_test2')
|
||||
|
@@ -29,7 +29,7 @@ class TestStreamPresence(SleekTest):
|
||||
self.xmpp.add_event_handler('got_offline', got_offline)
|
||||
self.xmpp.add_event_handler('presence_unavailable', unavailable)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<presence type="unavailable" from="otheruser@localhost" />
|
||||
""")
|
||||
|
||||
@@ -54,7 +54,7 @@ class TestStreamPresence(SleekTest):
|
||||
#
|
||||
# We use the stream to initialize the roster to make
|
||||
# the test independent of the roster implementation.
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<iq type="set">
|
||||
<query xmlns="jabber:iq:roster">
|
||||
<item jid="otheruser@localhost"
|
||||
@@ -67,12 +67,12 @@ class TestStreamPresence(SleekTest):
|
||||
""")
|
||||
|
||||
# Contact comes online.
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<presence from="otheruser@localhost/foobar" />
|
||||
""")
|
||||
|
||||
# Contact goes offline, should trigger got_offline.
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<presence from="otheruser@localhost/foobar"
|
||||
type="unavailable" />
|
||||
""")
|
||||
@@ -98,7 +98,7 @@ class TestStreamPresence(SleekTest):
|
||||
self.xmpp.add_event_handler('presence_available', presence_available)
|
||||
self.xmpp.add_event_handler('got_online', got_online)
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<presence from="user@localhost" />
|
||||
""")
|
||||
|
||||
@@ -135,15 +135,15 @@ class TestStreamPresence(SleekTest):
|
||||
self.xmpp.auto_authorize = True
|
||||
self.xmpp.auto_subscribe = True
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<presence from="user@localhost" type="subscribe" />
|
||||
""")
|
||||
|
||||
self.stream_send_presence("""
|
||||
self.send("""
|
||||
<presence to="user@localhost" type="subscribed" />
|
||||
""")
|
||||
|
||||
self.stream_send_presence("""
|
||||
self.send("""
|
||||
<presence to="user@localhost" type="subscribe" />
|
||||
""")
|
||||
|
||||
@@ -172,11 +172,11 @@ class TestStreamPresence(SleekTest):
|
||||
# With this setting we should reject all subscriptions.
|
||||
self.xmpp.auto_authorize = False
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<presence from="user@localhost" type="subscribe" />
|
||||
""")
|
||||
|
||||
self.stream_send_presence("""
|
||||
self.send("""
|
||||
<presence to="user@localhost" type="unsubscribed" />
|
||||
""")
|
||||
|
||||
|
@@ -20,12 +20,12 @@ class TestStreamRoster(SleekTest):
|
||||
t = threading.Thread(name='get_roster', target=self.xmpp.get_roster)
|
||||
t.start()
|
||||
|
||||
self.stream_send_iq("""
|
||||
self.send("""
|
||||
<iq type="get" id="1">
|
||||
<query xmlns="jabber:iq:roster" />
|
||||
</iq>
|
||||
""")
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<iq type="result" id="1">
|
||||
<query xmlns="jabber:iq:roster">
|
||||
<item jid="user@localhost"
|
||||
@@ -54,7 +54,7 @@ class TestStreamRoster(SleekTest):
|
||||
self.stream_start(mode='client')
|
||||
self.failUnless(self.xmpp.roster == {}, "Initial roster not empty.")
|
||||
|
||||
self.stream_recv("""
|
||||
self.recv("""
|
||||
<iq type="set" id="1">
|
||||
<query xmlns="jabber:iq:roster">
|
||||
<item jid="user@localhost"
|
||||
@@ -66,7 +66,7 @@ class TestStreamRoster(SleekTest):
|
||||
</query>
|
||||
</iq>
|
||||
""")
|
||||
self.stream_send_iq("""
|
||||
self.send("""
|
||||
<iq type="result" id="1">
|
||||
<query xmlns="jabber:iq:roster" />
|
||||
</iq>
|
||||
|
Reference in New Issue
Block a user