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:
Lance Stout
2010-11-05 14:45:58 -04:00
parent 7351fe1a02
commit d0c506f930
22 changed files with 242 additions and 355 deletions

View File

@@ -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>