diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-09-06 16:42:08 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-10-12 10:51:11 +0100 |
commit | f53172e06c29586a32989b11cf66aa2d28368ad0 (patch) | |
tree | 7fd8d76df6bc52f447fa56a5cf8e63a6e2491ae1 /tests | |
parent | 2f4d98398c24b95b1178871f62cf89a7bf467dd8 (diff) |
MUC: use id='' to catch SetSubject errors
Servers don't strictly have to echo the <subject/> element in their
reply if they reject our subject change message. But they do have to
preserve the id='' attribute.
This patch makes Gabble set an id='' attribute on <message/>s sent to
change the subject, and look for that ID when it receives a <message
type='error'/> from a MUC. (It continues to look for <subject/> errors,
too.)
Prosody is an example of a server that behaves like this.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/twisted/muc/subject.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/twisted/muc/subject.py b/tests/twisted/muc/subject.py index 0382884e3..a50413d72 100644 --- a/tests/twisted/muc/subject.py +++ b/tests/twisted/muc/subject.py @@ -185,6 +185,21 @@ def test_subject(q, bus, conn, stream, change_subject, send_first, stream.send(elem) q.expect('dbus-error', method='SetSubject', name=cs.PERMISSION_DENIED) + # Test changing the subject and getting an error back which doesn't echo + # the <subject> element. + call_async(q, chan, 'SetSubject', 'CHICKEN MAN', dbus_interface=cs.CHANNEL_IFACE_SUBJECT) + + e = q.expect('stream-message', to=room) + message = domish.Element((None, 'message')) + message['from'] = room + message['id'] = e.stanza['id'] + message['type'] = 'error' + error = message.addElement((None, 'error')) + error.addElement((ns.STANZA, 'forbidden')) + stream.send(message) + + q.expect('dbus-error', method='SetSubject', name=cs.PERMISSION_DENIED) + # Test changing the subject just before we leave the room (and hence not # getting a reply). While we're here, check that you can't have more than # one call in flight at a time. |