changeset 1057:7ea0215e7092

test: fixes the tests for plugin XEP-0033
author souliane <souliane@mailoo.org>
date Sun, 08 Jun 2014 17:39:21 +0200
parents a5cfa9bb4541
children 0a9986452bba
files src/test/test_plugin_xep_0033.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/test/test_plugin_xep_0033.py	Sun Jun 08 17:27:03 2014 +0200
+++ b/src/test/test_plugin_xep_0033.py	Sun Jun 08 17:39:21 2014 +0200
@@ -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 @@
             """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 @@
             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 @@
         # 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 @@
         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 @@
             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()