diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-12-14 17:55:40 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-12-15 19:02:07 +0000 |
commit | f8f8d46e044888b1208699e930e0e1aaa27456c0 (patch) | |
tree | 2e1687ab9a8edb5c64f5f44b6a33f531be08190f | |
parent | 170601eaec1fbabfe3da509fa7ec95ac3500f04b (diff) |
Test that the fix for fd.o#25341 works.
-rw-r--r-- | tests/twisted/Makefile.am | 1 | ||||
-rw-r--r-- | tests/twisted/vcard/redundant-set.py | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index 5a2dca806..50c90ae9d 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -79,6 +79,7 @@ TWISTED_TESTS = \ tubes/test-get-available-tubes.py \ tubes/test-socks5-muc.py \ vcard/overlapping-sets.py \ + vcard/redundant-set.py \ vcard/set-set-disconnect.py \ vcard/test-alias-empty-vcard.py \ vcard/test-alias-pep.py \ diff --git a/tests/twisted/vcard/redundant-set.py b/tests/twisted/vcard/redundant-set.py new file mode 100644 index 000000000..05a73f111 --- /dev/null +++ b/tests/twisted/vcard/redundant-set.py @@ -0,0 +1,47 @@ +""" +Regression test for <http://bugs.freedesktop.org/show_bug.cgi?id=25341>, where +Gabble redundantly re-set the user's own vCard even if nothing had changed. +""" + +from servicetest import EventPattern, sync_dbus +from gabbletest import exec_test, make_result_iq, sync_stream, GoogleXmlStream +import constants as cs + +def not_google(q, bus, conn, stream): + test(q, bus, conn, stream, False) + +def google(q, bus, conn, stream): + test(q, bus, conn, stream, True) + +def test(q, bus, conn, stream, is_google): + conn.Connect() + _, iq_event = q.expect_many( + EventPattern('dbus-signal', signal='StatusChanged', + args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]), + EventPattern('stream-iq', to=None, query_ns='vcard-temp', + query_name='vCard')) + + result = make_result_iq(stream, iq_event.stanza) + + # Testing reveals that Google's vCard server does not actually support + # NICKNAME (or indeed any fields beside FN and PHOTO): if you set a vCard + # including it, it accepts the request but strips out the unsupported + # fields. So if the server looks like Google, we don't bother re-setting + # the NICKNAME. + if not is_google: + vcard = result.firstChildElement() + vcard.addElement('NICKNAME', content='oh hello there') + + stream.send(result) + + q.forbid_events([ + EventPattern('stream-iq', iq_type='set', query_ns='vcard-temp', + query_name='vCard') + ]) + sync_stream(q, stream) + sync_dbus(bus, q, conn) + +if __name__ == '__main__': + exec_test(not_google, params={ 'alias': 'oh hello there' }) + exec_test(google, params={ 'alias': 'oh hello there' }, + protocol=GoogleXmlStream) |