def test_retrieve(self): client = mock.Mock() client.get.return_value = "\x80\x02K\nU\rget_templatesq\x01\x86q\x02." store = RedisBackingStore(60, client) result = store.retrieve("get_templates") self.assertEqual((10, "get_templates"), result) client.get.assert_called_once_with("get_templates")
def test_retrieve_generic_exc_handling(self): client = mock.Mock() client.get.side_effect = Exception() store = RedisBackingStore(60, client) self.assertEqual(None, store.retrieve("get_templates"))
def test_retrieve_conn_exc_handling(self): client = mock.Mock() client.get.side_effect = ConnectionError() store = RedisBackingStore(60, client) self.assertEqual(None, store.retrieve("get_templates"))