summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-09 13:00:30 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-09 14:20:21 +0100
commitb4c43657db63cbb88ac1c4ee394a636cd8537f84 (patch)
tree0840b92310a5b3a04d3f2b13b47886f5fe820681
parent92275e248608d7278829459f34095b22d3cf7c6b (diff)
Add a regression test for #68829
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68829 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--tests/twisted/Makefile.am1
-rw-r--r--tests/twisted/connect/disco-facebook.py51
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index ae24bd110..f23dc1e27 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -21,6 +21,7 @@ TWISTED_TESTS = \
client-types.py \
cm/protocol.py \
connect/disco-error-from-bare-jid.py \
+ connect/disco-facebook.py \
connect/disconnect-timeout.py \
connect/disco-no-reply.py \
connect/network-error.py \
diff --git a/tests/twisted/connect/disco-facebook.py b/tests/twisted/connect/disco-facebook.py
new file mode 100644
index 000000000..39cd9e631
--- /dev/null
+++ b/tests/twisted/connect/disco-facebook.py
@@ -0,0 +1,51 @@
+"""
+Test that Gabble is tolerant of non-RFC-compliance from Facebook.
+https://bugs.freedesktop.org/show_bug.cgi?id=68829
+"""
+
+from gabbletest import exec_test, XmppXmlStream
+import constants as cs
+import ns
+
+from twisted.words.xish import xpath
+
+def test(q, bus, conn, stream):
+ conn.Connect()
+
+ # everything is fine and actually very boring
+ q.expect('dbus-signal', signal='StatusChanged',
+ args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED]),
+ q.expect('dbus-signal', signal='StatusChanged',
+ args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+
+class XmppXmlStreamFacebook201309(XmppXmlStream):
+ """As of 2013-09, a new version of Facebook's XMPP server (used
+ consistently for beta.chat.facebook.com, and gradually being rolled out
+ for chat.facebook.com users) omits the 'from' attribute in its disco
+ reply. The disco reply is otherwise correct.
+ """
+
+ def _cb_disco_iq(self, iq):
+ nodes = xpath.queryForNodes(
+ "/iq/query[@xmlns='" + ns.DISCO_INFO + "']", iq)
+ query = nodes[0]
+
+ for feature in self.disco_features:
+ query.addChild(elem('feature', var=feature))
+
+ iq['type'] = 'result'
+
+ # The Facebook server's IQ responses have neither 'from' nor 'to'
+ try:
+ del iq['from']
+ except KeyError:
+ pass
+ try:
+ del iq['to']
+ except KeyError:
+ pass
+
+ self.send(iq)
+
+if __name__ == '__main__':
+ exec_test(test, protocol=XmppXmlStreamFacebook201309, do_connect=False)