Mercurial > libervia-backend
comparison src/test/test_plugin_xep_0085.py @ 1271:2308f8405ffb
test: refactoring:
- rename internal init methods to reinit
- rename getSentMessage to getSentMessageXml
- rename getSentMessageRaw to getSentMessage
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 19 Dec 2014 11:36:00 +0100 |
parents | 87fbe4640448 |
children | 347aee3a3f5c |
comparison
equal
deleted
inserted
replaced
1270:037ec0795a85 | 1271:2308f8405ffb |
---|---|
35 def setUp(self): | 35 def setUp(self): |
36 self.host = helpers.FakeSAT() | 36 self.host = helpers.FakeSAT() |
37 self.plugin = plugin.XEP_0085(self.host) | 37 self.plugin = plugin.XEP_0085(self.host) |
38 | 38 |
39 def test_messageReceived(self): | 39 def test_messageReceived(self): |
40 self.host.memory.init() | 40 self.host.memory.reinit() |
41 self.host.memory.setParam(plugin.PARAM_NAME, True, plugin.PARAM_KEY, C.NO_SECURITY_LIMIT, Const.PROFILE[0]) | 41 self.host.memory.setParam(plugin.PARAM_NAME, True, plugin.PARAM_KEY, C.NO_SECURITY_LIMIT, Const.PROFILE[0]) |
42 for state in plugin.CHAT_STATES: | 42 for state in plugin.CHAT_STATES: |
43 xml = u""" | 43 xml = u""" |
44 <message type="chat" from="%s" to="%s" id="test_1"> | 44 <message type="chat" from="%s" to="%s" id="test_1"> |
45 %s | 45 %s |
52 stanza = parseXml(xml.encode("utf-8")) | 52 stanza = parseXml(xml.encode("utf-8")) |
53 self.host.bridge.expectCall("chatStateReceived", Const.JID_STR[1], state, Const.PROFILE[0]) | 53 self.host.bridge.expectCall("chatStateReceived", Const.JID_STR[1], state, Const.PROFILE[0]) |
54 self.plugin.messageReceivedTrigger(stanza, defer.Deferred(), Const.PROFILE[0]) | 54 self.plugin.messageReceivedTrigger(stanza, defer.Deferred(), Const.PROFILE[0]) |
55 | 55 |
56 def test_sendMessageTrigger(self): | 56 def test_sendMessageTrigger(self): |
57 self.host.memory.init() | 57 self.host.memory.reinit() |
58 self.host.memory.setParam(plugin.PARAM_NAME, True, plugin.PARAM_KEY, C.NO_SECURITY_LIMIT, Const.PROFILE[0]) | 58 self.host.memory.setParam(plugin.PARAM_NAME, True, plugin.PARAM_KEY, C.NO_SECURITY_LIMIT, Const.PROFILE[0]) |
59 for state in plugin.CHAT_STATES: | 59 for state in plugin.CHAT_STATES: |
60 mess_data = {"to": Const.JID[0], | 60 mess_data = {"to": Const.JID[0], |
61 "type": "chat", | 61 "type": "chat", |
62 "message": "content", | 62 "message": "content", |