[Telepathy-commits] [telepathy-gabble/master] add gabbletest.make_presence
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Mar 6 07:14:34 PST 2009
---
tests/twisted/gabbletest.py | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py
index bcead37..e17a00e 100644
--- a/tests/twisted/gabbletest.py
+++ b/tests/twisted/gabbletest.py
@@ -513,3 +513,21 @@ def elem_iq(server, type, **kw):
iq[k] = v
return iq
+
+def make_presence(_from, to='test at localhost', type=None, status=None, caps=None):
+ presence = domish.Element((None, 'presence'))
+ presence['from'] = _from
+ presence['to'] = to
+
+ if type is not None:
+ presence['type'] = type
+
+ if status is not None:
+ presence.addElement('status', content=status)
+
+ if caps is not None:
+ cel = presence.addElement(('http://jabber.org/protocol/caps', 'c'))
+ for key,value in caps.items():
+ cel[key] = value
+
+ return presence
--
1.5.6.5
More information about the telepathy-commits
mailing list