def test_get(self): """ Test if it retrieve value for a key """ class MockMemcache: """ Mock of memcache """ @staticmethod def get_stats(): """ Mock of stats method """ return [("127.0.0.1:11211 (1)", {})] @staticmethod def get(key): """ Mock of get method """ return key with patch.object(memcached, "_connect", MagicMock(return_value=MockMemcache())): self.assertEqual(memcached.get("salt"), "salt")
def test_get(self): ''' Test if it retrieve value for a key ''' class MockMemcache(object): """ Mock of memcache """ @staticmethod def get_stats(): """ Mock of stats method """ return [('127.0.0.1:11211 (1)', {})] @staticmethod def get(key): """ Mock of get method """ return key with patch.object(memcached, '_connect', MagicMock(return_value=MockMemcache())): self.assertEqual(memcached.get('salt'), 'salt')
def test_get(self): ''' Test if it retrieve value for a key ''' class MockMemcache(object): """ Mock of memcache """ @staticmethod def get_stats(): """ Mock of stats method """ return [('127.0.0.1:11211 (1)', {})] @staticmethod def get(key): """ Mock of get method """ return key with patch.object(memcached, '_connect', MagicMock(return_value=MockMemcache())): self.assertEqual(memcached.get('salt'), 'salt')