[telepathy-salut/master] caps_helper: add check_caps
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Mon Mar 30 09:55:15 PDT 2009
---
tests/twisted/avahi/caps_helper.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/tests/twisted/avahi/caps_helper.py b/tests/twisted/avahi/caps_helper.py
index d142caa..76faadb 100644
--- a/tests/twisted/avahi/caps_helper.py
+++ b/tests/twisted/avahi/caps_helper.py
@@ -1,6 +1,9 @@
import hashlib
import base64
+from avahitest import txt_get_key
+import ns
+
def compute_caps_hash(identities, features, dataforms):
S = ''
@@ -16,6 +19,20 @@ def compute_caps_hash(identities, features, dataforms):
m.update(S)
return base64.b64encode(m.digest())
+def check_caps(txt, ver):
+ for (key, val) in { "1st": "test",
+ "last": "suite",
+ "status": "avail",
+ "txtvers": "1" }.iteritems():
+ v = txt_get_key(txt, key)
+ assert v == val, (key, val, v)
+
+ assert txt_get_key(txt, "hash") == "sha-1"
+ assert txt_get_key(txt, "node") == ns.TELEPATHY_CAPS
+
+ v = txt_get_key(txt, "ver")
+ assert v == ver, (v, ver)
+
if __name__ == '__main__':
# example from XEP-0115
assert compute_caps_hash(['client/pc//Exodus 0.9.1'],
--
1.5.6.5
More information about the telepathy-commits
mailing list