diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-04-28 18:42:58 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2010-04-28 18:48:20 +0100 |
commit | 9786d5ec1502139ee5184d9003851a7d9cca35bc (patch) | |
tree | 83d5a31ce2bca15f240578444b29870811cef9cb | |
parent | 8151bd71e98f56354fa950b4ad590f7c536193d9 (diff) |
Break up the Google roster test a bit.
-rw-r--r-- | tests/twisted/roster/test-google-roster.py | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py index 8c4f05837..1169d21ab 100644 --- a/tests/twisted/roster/test-google-roster.py +++ b/tests/twisted/roster/test-google-roster.py @@ -42,8 +42,17 @@ def add_roster_item(query, contact, state, ask, attrs={}): return item -def test(q, bus, conn, stream): - conn.Connect() +def is_stored(event): + return event.path.endswith('/stored') + +def is_subscribe(event): + return event.path.endswith('/subscribe') + +def test_inital_roster(q, bus, conn, stream): + """ + This part of the test checks that Gabble correctly alters on which lists + contacts appear based on the google:roster attributes and special-cases. + """ event = q.expect('stream-iq', query_ns=ns.ROSTER) query = event.query @@ -88,6 +97,14 @@ def test(q, bus, conn, stream): stored = expect_list_channel(q, bus, conn, 'stored', expected_contacts+rp_contacts) + return (publish, subscribe, stored) + +def test_flickering(q, bus, conn, stream, subscribe): + """ + Google's server is buggy, and subscription state transitions "flicker" + sometimes. Here, we test that Gabble is suppressing the flickers. + """ + contact = 'bob@foo.com' handle = conn.RequestHandles(cs.HT_CONTACT, ['bob@foo.com'])[0] @@ -124,12 +141,6 @@ def test(q, bus, conn, stream): "none", True) stream.send(iq) - def is_stored(event): - return event.path.endswith('/stored') - - def is_subscribe(event): - return event.path.endswith('/subscribe') - # Gabble should report this update to the UI. q.expect_many( EventPattern('dbus-signal', signal='MembersChanged', @@ -209,5 +220,12 @@ def test(q, bus, conn, stream): sync_dbus(bus, q, conn) q.unforbid_events(change_events) +def test(q, bus, conn, stream): + conn.Connect() + + publish, subscribe, stored = test_inital_roster(q, bus, conn, stream) + + test_flickering(q, bus, conn, stream, subscribe) + if __name__ == '__main__': exec_test(test, protocol=GoogleXmlStream) |