[Telepathy-commits] [telepathy-gabble/master] Twisted tests: Use False and True instead of 0 and 1 in Python
Alban Crequy
alban.crequy at collabora.co.uk
Tue Aug 19 10:52:48 PDT 2008
20080528105223-a41c0-e1976c68c87a16960c84dcf03aeb3f72c723eb8f.gz
---
tests/twisted/test-caps-cache.py | 24 ++++++++++++++++--------
tests/twisted/test-caps-hash.py | 28 ++++++++++++++--------------
2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/tests/twisted/test-caps-cache.py b/tests/twisted/test-caps-cache.py
index 098ed75..9977439 100644
--- a/tests/twisted/test-caps-cache.py
+++ b/tests/twisted/test-caps-cache.py
@@ -144,17 +144,25 @@ def test(q, bus, conn, stream):
client = 'http://telepathy.freedesktop.org/fake-client'
- _test_without_hash(q, bus, conn, stream, 'bob1 at foo.com/Foo', 2L, client, 1)
- _test_without_hash(q, bus, conn, stream, 'bob2 at foo.com/Foo', 3L, client, 1)
- _test_without_hash(q, bus, conn, stream, 'bob3 at foo.com/Foo', 4L, client, 1)
- _test_without_hash(q, bus, conn, stream, 'bob4 at foo.com/Foo', 5L, client, 1)
- _test_without_hash(q, bus, conn, stream, 'bob5 at foo.com/Foo', 6L, client, 1)
+ _test_without_hash(q, bus, conn, stream, 'bob1 at foo.com/Foo', 2L, client,
+ True)
+ _test_without_hash(q, bus, conn, stream, 'bob2 at foo.com/Foo', 3L, client,
+ True)
+ _test_without_hash(q, bus, conn, stream, 'bob3 at foo.com/Foo', 4L, client,
+ True)
+ _test_without_hash(q, bus, conn, stream, 'bob4 at foo.com/Foo', 5L, client,
+ True)
+ _test_without_hash(q, bus, conn, stream, 'bob5 at foo.com/Foo', 6L, client,
+ True)
# we have 5 different contacts that confirm
- _test_without_hash(q, bus, conn, stream, 'bob6 at foo.com/Foo', 7L, client, 0)
+ _test_without_hash(q, bus, conn, stream, 'bob6 at foo.com/Foo', 7L, client,
+ False)
- _test_with_hash(q, bus, conn, stream, 'bilbo1 at foo.com/Foo', 8L, client, 1)
+ _test_with_hash(q, bus, conn, stream, 'bilbo1 at foo.com/Foo', 8L, client,
+ True)
# 1 contact is enough with hash
- _test_with_hash(q, bus, conn, stream, 'bilbo2 at foo.com/Foo', 9L, client, 0)
+ _test_with_hash(q, bus, conn, stream, 'bilbo2 at foo.com/Foo', 9L, client,
+ False)
conn.Disconnect()
q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
diff --git a/tests/twisted/test-caps-hash.py b/tests/twisted/test-caps-hash.py
index c7eb1ff..8f03505 100644
--- a/tests/twisted/test-caps-hash.py
+++ b/tests/twisted/test-caps-hash.py
@@ -34,13 +34,13 @@ sm = 'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
conn_iface = 'org.freedesktop.Telepathy.Connection'
caps_iface = 'org.freedesktop.Telepathy.Connection.Interface.Capabilities'
-caps_changed_flag = 0
+caps_changed_flag = False
def caps_changed_cb(dummy):
# Workaround to bug 9980: do not raise an error but use a flag
# https://bugs.freedesktop.org/show_bug.cgi?id=9980
global caps_changed_flag
- caps_changed_flag = 1
+ caps_changed_flag = True
def make_presence(from_jid, type, status):
presence = domish.Element((None, 'presence'))
@@ -108,7 +108,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# we can now do audio calls
event = q.expect('dbus-signal', signal='CapabilitiesChanged')
- caps_changed_flag = 0
+ caps_changed_flag = False
# send bogus presence
presence = make_presence(contact, None, 'hello')
@@ -135,7 +135,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# don't receive any D-Bus signal
dbus_sync(bus, q, conn)
- assert caps_changed_flag == 0
+ assert caps_changed_flag == False
# send presence with empty caps
presence = make_presence(contact, None, 'hello')
@@ -151,7 +151,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# still don't receive any D-Bus signal
dbus_sync(bus, q, conn)
- assert caps_changed_flag == 0
+ assert caps_changed_flag == False
# send good reply
result = make_result_iq(stream, event.stanza)
@@ -160,8 +160,8 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# we can now do nothing
event = q.expect('dbus-signal', signal='CapabilitiesChanged')
- assert caps_changed_flag == 1
- caps_changed_flag = 0
+ assert caps_changed_flag == True
+ caps_changed_flag = False
# send correct presence
presence = make_presence(contact, None, 'hello')
@@ -180,7 +180,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# don't receive any D-Bus signal
dbus_sync(bus, q, conn)
- assert caps_changed_flag == 0
+ assert caps_changed_flag == False
# send good reply
result = make_result_iq(stream, event.stanza)
@@ -216,8 +216,8 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
# we can now do audio calls
event = q.expect('dbus-signal', signal='CapabilitiesChanged')
- assert caps_changed_flag == 1
- caps_changed_flag = 0
+ assert caps_changed_flag == True
+ caps_changed_flag = False
def test_two_clients(q, bus, conn, stream, contact1, contact2,
contact_handle1, contact_handle2, client, broken_hash):
@@ -261,7 +261,7 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
# don't receive any D-Bus signal
dbus_sync(bus, q, conn)
- assert caps_changed_flag == 0
+ assert caps_changed_flag == False
# send good reply
result = make_result_iq(stream, event.stanza)
@@ -289,7 +289,7 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
# don't receive any D-Bus signal
dbus_sync(bus, q, conn)
- assert caps_changed_flag == 0
+ assert caps_changed_flag == False
# send good reply
result = make_result_iq(stream, event.stanza)
@@ -311,11 +311,11 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
event = q.expect('dbus-signal', signal='CapabilitiesChanged',
args=[[(contact_handle1, sm, 0, 3, 0, 1)]])# what are the good values?!
- caps_changed_flag = 0
+ caps_changed_flag = False
# don't receive any D-Bus signal
dbus_sync(bus, q, conn)
- assert caps_changed_flag == 0
+ assert caps_changed_flag == False
def test(q, bus, conn, stream):
conn.Connect()
--
1.5.6.3
More information about the Telepathy-commits
mailing list