Commit 8946af33 authored by André's avatar André Committed by Philipp Hörist
Browse files

Test: caps cache: use mock from unittest

parent e8941a4f
......@@ -6,13 +6,11 @@
import lib
from unittest.mock import MagicMock
from unittest.mock import MagicMock, Mock
from nbxmpp import NS_MUC, NS_PING, NS_XHTML_IM, Iq
from gajim.common import caps_cache as caps
from gajim.common.modules.discovery import Discovery
from mock import Mock
<iq from='benvolio@capulet.lit/230193' id='disco1' to='juliet@capulet.lit/chamber' type='result'>
<query xmlns='' node=''>
......@@ -64,7 +62,8 @@ def setUp(self):
db_caps_cache = [
(self.caps_method, self.caps_hash, self.identities, self.features),
('old', self.node + '#' + self.caps_hash, self.identities, self.features)]
self.logger = Mock(returnValues={"iter_caps_data":db_caps_cache})
self.logger = Mock()
self.logger.iter_caps_data = Mock(return_value=db_caps_cache) = caps.CapsCache(self.logger)
caps.capscache =
......@@ -95,8 +94,10 @@ def test_set_and_store(self):
item =[self.client_caps]
item.set_and_store(self.identities, self.features)
self.logger.mockCheckCall(0, "add_caps_entry", self.caps_method,
self.caps_hash, self.identities, self.features)
def test_initialize_from_db(self):
''' Read cashed dummy data from db '''
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment