test: fixes FakeSAT for plugin XEP-0033

This commit is contained in:
souliane 2014-09-17 10:02:24 +02:00
commit 9fbddc69e9

View file

@ -84,12 +84,31 @@ class FakeSAT(object):
def sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key='@NONE@'):
self.sendAndStoreMessage({"to": JID(to_s)})
def sendAndStoreMessage(self, mess_data, skip_send=False, profile=None):
"""Save the information to check later to whom messages have been sent and
if entries have been added to the history"""
if not skip_send:
self.sent_messages.append(mess_data["to"])
def _sendMessageToStream(self, mess_data, client):
"""Save the information to check later to whom messages have been sent.
@param mess_data: message data dictionnary
@param client: profile's client
"""
self.sent_messages.append(mess_data["to"])
return mess_data
def _storeMessage(self, mess_data, client):
"""Save the information to check later if entries have been added to the history.
@param mess_data: message data dictionnary
@param client: profile's client
"""
self.stored_messages.append(mess_data["to"])
return mess_data
def sendMessageToBridge(self, mess_data, client):
"""Simulate the message being sent to the frontends.
@param mess_data: message data dictionnary
@param client: profile's client
"""
return mess_data # TODO
def getClient(self, profile_key):
"""Convenient method to get client from profile key