test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033

This commit is contained in:
souliane 2014-01-07 09:27:53 +01:00
commit 6be767ae3b

View file

@ -28,6 +28,7 @@ from twisted.trial import unittest
from twisted.internet import defer
from twisted.words.protocols.jabber.jid import JID
from xml.etree import cElementTree as etree
from collections import Counter
import re
@ -48,6 +49,10 @@ class DifferentXMLException(FailTest):
pass
class DifferentListException(FailTest):
pass
class FakeSAT(object):
"""Class to simulate a SAT instance"""
@ -292,3 +297,16 @@ class SatTestCase(unittest.TestCase):
print "was expecting:\n-\n%s\n-\n\n" % etree.tostring(expected_elt, encoding='utf-8')
print "---"
raise DifferentXMLException
def assertEqualUnsortedList(self, a, b, msg):
counter_a = Counter(a)
counter_b = Counter(b)
if counter_a != counter_b:
print "---"
print "Unsorted lists are not equals:"
print "got : %s" % counter_a
print "was expecting: %s" % counter_b
if msg:
print msg
print "---"
raise DifferentListException