本文整理汇总了Python中mockredis.MockRedis方法的典型用法代码示例。如果您正苦于以下问题:Python mockredis.MockRedis方法的具体用法?Python mockredis.MockRedis怎么用?Python mockredis.MockRedis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mockredis
的用法示例。
在下文中一共展示了mockredis.MockRedis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_context
# 需要导入模块: import mockredis [as 别名]
# 或者: from mockredis import MockRedis [as 别名]
def test_context(self):
panoptes_context = PanoptesContext(self.panoptes_test_conf_file)
self.assertIsInstance(panoptes_context, PanoptesContext)
self.assertEqual(panoptes_context.config_object.redis_urls[0].url, u'redis://:password@localhost:6379/0')
self.assertEqual(str(panoptes_context.config_object.redis_urls[0]), u'redis://:**@localhost:6379/0')
self.assertEqual(panoptes_context.config_object.zookeeper_servers, set([u'localhost:2181']))
self.assertEqual(panoptes_context.config_object.kafka_brokers, set([u'localhost:9092']))
self.assertIsInstance(panoptes_context.config_dict, dict)
self.assertIsInstance(panoptes_context.logger, _loggerClass)
self.assertIsInstance(panoptes_context.redis_pool, MockRedis)
with self.assertRaises(AttributeError):
panoptes_context.kafka_client
with self.assertRaises(AttributeError):
panoptes_context.zookeeper_client
del panoptes_context
示例2: __init__
# 需要导入模块: import mockredis [as 别名]
# 或者: from mockredis import MockRedis [as 别名]
def __init__(self, connection=None, encoding=None, **kwargs):
# Just for API compatibility
self._conn = connection
self._redis = _MockRedis(**kwargs)
self._encoding = encoding
示例3: setUp
# 需要导入模块: import mockredis [as 别名]
# 或者: from mockredis import MockRedis [as 别名]
def setUp(self):
self.memory = MemoryStorage()
self.redis_object = Redis()
self.redis_storage = RedisStorage(self.redis_object)
示例4: mock_queue_client
# 需要导入模块: import mockredis [as 别名]
# 或者: from mockredis import MockRedis [as 别名]
def mock_queue_client(monkeypatch):
# Stop mockredis from trying to run Lua imports that aren't really needed.
monkeypatch.setattr('mockredis.script.Script._import_lua_dependencies',
staticmethod(lambda *args, **kwargs: None))
cl = QueueClient(zone='testzone')
cl.redis = mockredis.MockRedis()
return cl