summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2013-02-22 08:15:30 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2013-02-22 08:33:14 +0000
commit114c5bc092a9645ecb26cb3310b01d6c8fc08cbc (patch)
treedd98043e465e0be8db50e840fab7069d31e19e8d
parent62fa6bd989afaec604f420692e10e7716a28496c (diff)
muc/chat-states: tidy up checking message bodies
-rw-r--r--tests/twisted/muc/chat-states.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/twisted/muc/chat-states.py b/tests/twisted/muc/chat-states.py
index eaa5c65e2..b5b389846 100644
--- a/tests/twisted/muc/chat-states.py
+++ b/tests/twisted/muc/chat-states.py
@@ -3,7 +3,7 @@ Regression test for <https://bugs.freedesktop.org/show_bug.cgi?id=32952>,
wherein chat states in MUCs were misparsed, and MUC chat states in general.
"""
-from servicetest import assertEquals
+from servicetest import assertEquals, assertLength
from gabbletest import exec_test, elem
from mucutil import join_muc_and_check
import ns
@@ -111,13 +111,9 @@ def test(q, bus, conn, stream):
assertEquals(cs.CHAT_STATE_ACTIVE,
states.get(user, cs.CHAT_STATE_INACTIVE))
- def is_body(e):
- if e.name == 'body':
- assert e.children[0] == u'hi.', e.toXml()
- return True
- return False
-
- assert len([x for x in stanza.elements() if is_body(x)]) == 1, stanza.toXml()
+ bodies = list(stanza.elements(uri=ns.CLIENT, name='body'))
+ assertLength(1, bodies)
+ assertEquals(u'hi.', bodies[0].children[0])
if __name__ == '__main__':
exec_test(test)