summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-09-01 14:35:59 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-10-12 10:51:12 +0100
commit59ee55354fee1a9425790886ea98f342340e390b (patch)
treeb7fe4abae1cdc53fe0ef3699eca6502a8e0b7f2f /tests
parent3a7eadb2ce77968034832ce7d0f039d15fdb3256 (diff)
MUC: hook up UpdateConfiguration
This simultaneously un-hooks-up SetProperties. I could have refactored to make it possible to keep both, but I don't think it would buy us anything since we're just about to delete old properties anyway.
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/muc/test-muc-properties.py49
1 files changed, 33 insertions, 16 deletions
diff --git a/tests/twisted/muc/test-muc-properties.py b/tests/twisted/muc/test-muc-properties.py
index 6d9036654..b23b3b6d8 100644
--- a/tests/twisted/muc/test-muc-properties.py
+++ b/tests/twisted/muc/test-muc-properties.py
@@ -3,6 +3,7 @@
Test MUC properties support.
"""
+import dbus
from twisted.words.xish import xpath
from gabbletest import (
@@ -113,7 +114,7 @@ def test(q, bus, conn, stream):
q.expect('dbus-signal', signal='PropertiesChanged')
text_chan = wrap_channel(
- bus.get_object(conn.bus_name, ret.value[0]), 'Text')
+ bus.get_object(conn.bus_name, ret.value[0]), 'Text', ['RoomConfig1'])
config = text_chan.Properties.GetAll(cs.CHANNEL_IFACE_ROOM_CONFIG)
# Verify that all of the config properties (besides the password ones)
@@ -143,13 +144,16 @@ def test(q, bus, conn, stream):
'Description',
'Persistent',
'Private',
+ 'PasswordProtected',
+ 'Password',
],
config['MutableProperties'])
- props = dict([(name, id)
- for id, name, sig, flags in text_chan.TpProperties.ListProperties()])
- call_async(q, text_chan.TpProperties, 'SetProperties',
- [(props['password'], 'foo'), (props['password-required'], True)])
+ props = dbus.Dictionary(
+ { 'Password': 'foo',
+ 'PasswordProtected': True,
+ }, signature='sv')
+ call_async(q, text_chan.RoomConfig1, 'UpdateConfiguration', props)
event = q.expect('stream-iq', to='chat@conf.localhost', iq_type='get',
query_ns=ns.MUC_OWNER)
@@ -173,21 +177,34 @@ def test(q, bus, conn, stream):
}, form)
acknowledge_iq(stream, event.stanza)
- event = q.expect('dbus-signal', signal='PropertiesChanged')
- assertEquals(
- [[(props['password'], 'foo'),
- (props['password-required'], True),
- ]], event.args)
+ # FIXME: verify this signal
+ # q.expect('dbus-signal', signal='PropertiesChanged')
+
+ q.expect('dbus-return', method='UpdateConfiguration')
- q.expect('dbus-return', method='SetProperties', value=())
+ config = text_chan.Properties.GetAll(cs.CHANNEL_IFACE_ROOM_CONFIG)
+ assertEquals(True, config['PasswordProtected'])
+ assertEquals('foo', config['Password'])
+
+ # Check unknown fields are rejected.
+ props = dbus.Dictionary(
+ { 'PasswordProtected': True,
+ 'Riding on a donkey': True,
+ }, signature='sv')
+ call_async(q, text_chan.RoomConfig1, 'UpdateConfiguration', props)
+ q.expect('dbus-error', name=cs.INVALID_ARGUMENT)
- call_async(q, text_chan.TpProperties, 'SetProperties',
- [(31337, 'foo'), (props['password-required'], True)])
+ # Check that mis-typed fields are rejected.
+ props = dbus.Dictionary(
+ { 'PasswordProtected': 'foo',
+ 'Password': True,
+ }, signature='sv')
+ call_async(q, text_chan.RoomConfig1, 'UpdateConfiguration', props)
q.expect('dbus-error', name=cs.INVALID_ARGUMENT)
- call_async(q, text_chan.TpProperties, 'SetProperties',
- [(props['password'], True), (props['password-required'], 'foo')])
- q.expect('dbus-error', name=cs.NOT_AVAILABLE)
+ # Updating no fields should be a no-op, and not wait on any network
+ # traffic.
+ text_chan.RoomConfig1.UpdateConfiguration({})
if __name__ == '__main__':
exec_test(test)