def test_status_false(self): ''' Test if it gets memcached status ''' class MockMemcache(object): """ Mock of memcache """ @staticmethod def get_stats(): """ Mock of stats method """ return [] with patch.object(memcached, '_connect', MagicMock(return_value=MockMemcache())): self.assertFalse(memcached.status())
def test_status(self): ''' Test if it gets memcached status ''' class MockMemcache(object): """ Mock of memcache """ @staticmethod def get_stats(): """ Mock of stats method """ return [('127.0.0.1:11211 (1)', {})] with patch.object(memcached, '_connect', MagicMock(return_value=MockMemcache())): self.assertDictEqual(memcached.status(), {'127.0.0.1:11211 (1)': {}})
def test_status_false(self): """ Test if it gets memcached status """ class MockMemcache(object): """ Mock of memcache """ @staticmethod def get_stats(): """ Mock of stats method """ return [] with patch.object( memcached, "_connect", MagicMock(return_value=MockMemcache()) ): self.assertFalse(memcached.status())