[Telepathy-commits] [telepathy-gabble/master] Allow tests to omit tube id when looking for old-style tubes
Will Thompson
will.thompson at collabora.co.uk
Tue Feb 3 03:36:40 PST 2009
---
tests/twisted/tubes/tubetestutil.py | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/tubes/tubetestutil.py b/tests/twisted/tubes/tubetestutil.py
index e118e88..b48048f 100644
--- a/tests/twisted/tubes/tubetestutil.py
+++ b/tests/twisted/tubes/tubetestutil.py
@@ -10,23 +10,31 @@ from constants import *
def check_tube_in_tubes(tube, tubes):
"""
Check that 'tube' is in 'tubes', which should be the return value of
- ListTubes()
+ ListTubes(). tube[0] may be None to check that a new-style tube is
+ represented on the old interface (because you don't know what its id is in
+ those cases)
"""
utube = unwrap(tube)
- for t in tubes:
- if tube[0] != t[0]:
- continue
- pair = "\n %s,\n %s" % (utube, unwrap(t))
+ if tube[0] is None:
+ for t in tubes:
+ if tube[1:] == t[1:]:
+ return
+ else:
+ for t in tubes:
+ if tube[0] != t[0]:
+ continue
+
+ pair = "\n %s,\n %s" % (utube, unwrap(t))
- assert tube[1] == t[1], "self handles don't match: %s" % pair
- assert tube[2] == t[2], "tube types don't match: %s" % pair
- assert tube[3] == t[3], "services don't match: %s " % pair
- assert tube[4] == t[4], "parameters don't match: %s" % pair
- assert tube[5] == t[5], "states don't match: %s" % pair
+ assert tube[1] == t[1], "self handles don't match: %s" % pair
+ assert tube[2] == t[2], "tube types don't match: %s" % pair
+ assert tube[3] == t[3], "services don't match: %s " % pair
+ assert tube[4] == t[4], "parameters don't match: %s" % pair
+ assert tube[5] == t[5], "states don't match: %s" % pair
- return
+ return
assert False, "tube %s not in %s" % (unwrap (tube), unwrap (tubes))
--
1.5.6.5
More information about the telepathy-commits
mailing list