test: fixes the tests for plugin XEP-0033
This commit is contained in:
parent
6f5de58d6e
commit
2afa53f755
1 changed files with 6 additions and 8 deletions
|
|
@ -23,7 +23,7 @@
|
|||
from constants import Const
|
||||
from sat.test import helpers
|
||||
from sat.plugins import plugin_xep_0033 as plugin
|
||||
from sat.core.sat_main import AbortSendMessage, MessageSentAndStored
|
||||
from sat.core.exceptions import CancelError
|
||||
from sat.core.log import getLogger
|
||||
from copy import deepcopy
|
||||
from twisted.internet import defer
|
||||
|
|
@ -103,8 +103,6 @@ class XEP_0033Test(helpers.SatTestCase):
|
|||
"""If the failure does encapsulate the expected exception, it will be silently
|
||||
trapped, otherwise it will be re-raised and will make the test fail"""
|
||||
failure.trap(exception_class)
|
||||
if exception_class == MessageSentAndStored:
|
||||
assertAddresses(failure.value.mess_data)
|
||||
|
||||
def checkSentAndStored():
|
||||
"""Check that all the recipients got their messages and that the history has been filled.
|
||||
|
|
@ -137,7 +135,7 @@ class XEP_0033Test(helpers.SatTestCase):
|
|||
job. It should abort sending the message or add the extended
|
||||
addressing information to the stanza.
|
||||
@param data: the data to be processed by self.plugin.sendMessageTrigger
|
||||
@param exception: AbortSendMessage or MessageSentAndStored
|
||||
@param exception: CancelError
|
||||
"""
|
||||
logger = getLogger()
|
||||
level = logger.getEffectiveLevel()
|
||||
|
|
@ -152,14 +150,14 @@ class XEP_0033Test(helpers.SatTestCase):
|
|||
# feature is not supported, abort the message
|
||||
self.host.memory.init()
|
||||
data = deepcopy(mess_data)
|
||||
trigger(data, AbortSendMessage)
|
||||
trigger(data, CancelError)
|
||||
|
||||
# feature is supported by the main target server
|
||||
self.host.init()
|
||||
self.host.memory.init()
|
||||
self.host.addFeature(JID(JID_STR_TO), plugin.NS_ADDRESS, PROFILE)
|
||||
data = deepcopy(mess_data)
|
||||
trigger(data, MessageSentAndStored)
|
||||
trigger(data, CancelError)
|
||||
checkSentAndStored()
|
||||
|
||||
# feature is supported by all target servers
|
||||
|
|
@ -169,7 +167,7 @@ class XEP_0033Test(helpers.SatTestCase):
|
|||
for dest in (JID_STR_X_TO, JID_STR_X_CC, JID_STR_X_BCC):
|
||||
self.host.addFeature(JID(JID(dest).host), plugin.NS_ADDRESS, PROFILE)
|
||||
data = deepcopy(mess_data)
|
||||
trigger(data, MessageSentAndStored)
|
||||
trigger(data, CancelError)
|
||||
checkSentAndStored()
|
||||
|
||||
# check that a wrong recipient entity is fixed by the backend
|
||||
|
|
@ -180,5 +178,5 @@ class XEP_0033Test(helpers.SatTestCase):
|
|||
self.host.addFeature(JID(JID(dest).host), plugin.NS_ADDRESS, PROFILE)
|
||||
data = deepcopy(mess_data)
|
||||
data["to"] = JID(JID_STR_X_TO)
|
||||
trigger(data, MessageSentAndStored)
|
||||
trigger(data, CancelError)
|
||||
checkSentAndStored()
|
||||
|
|
|
|||
Loading…
Reference in a new issue