def test_mutable(): sm = StoreMixin() sm.open_storage(MemoryStoragePlugin(None), 'ns') sm['toto'] = [1, 3] with sm.mutable('toto') as titi: titi[1] = 5 assert sm['toto'] == [1, 5]
def test_mutable(): sm = StoreMixin() sm.open_storage(MemoryStoragePlugin(None), "ns") sm["toto"] = [1, 3] with sm.mutable("toto") as titi: titi[1] = 5 assert sm["toto"] == [1, 5]
def test_storage(self): key = b'test' if PY2 else 'test' config = sys.modules['errbot.config-template'] bot_config_defaults(config) spm = SpecificPluginManager(config, 'storage', StoragePluginBase, CORE_STORAGE, None) storage_plugin = spm.get_plugin_by_name('Memory') persistent_object = StoreMixin() persistent_object.open_storage(storage_plugin, 'test') persistent_object[key] = 'à value' self.assertEquals(persistent_object[key], 'à value') self.assertIn(key, persistent_object) del persistent_object[key] self.assertNotIn(key, persistent_object) self.assertEquals(len(persistent_object), 0)
def test_storage(): key = 'test' __import__('errbot.config-template') config = ShallowConfig() config.__dict__.update(sys.modules['errbot.config-template'].__dict__) bot_config_defaults(config) spm = BackendPluginManager(config, 'errbot.storage', 'Memory', StoragePluginBase, CORE_STORAGE) storage_plugin = spm.load_plugin() persistent_object = StoreMixin() persistent_object.open_storage(storage_plugin, 'test') persistent_object[key] = 'à value' assert persistent_object[key] == 'à value' assert key in persistent_object del persistent_object[key] assert key not in persistent_object assert len(persistent_object) == 0
def test_storage(): key = b'test' if PY2 else 'test' __import__('errbot.config-template') config = ShallowConfig() config.__dict__.update(sys.modules['errbot.config-template'].__dict__) bot_config_defaults(config) spm = SpecificPluginManager(config, 'storage', StoragePluginBase, CORE_STORAGE, None) storage_plugin = spm.get_plugin_by_name('Memory') persistent_object = StoreMixin() persistent_object.open_storage(storage_plugin, 'test') persistent_object[key] = 'à value' assert persistent_object[key] == 'à value' assert key in persistent_object del persistent_object[key] assert key not in persistent_object assert len(persistent_object) == 0
def test_storage(): key = 'test' __import__('errbot.config-template') config = ShallowConfig() config.__dict__.update(sys.modules['errbot.config-template'].__dict__) bot_config_defaults(config) spm = SpecificPluginManager(config, 'storage', StoragePluginBase, CORE_STORAGE, None) storage_plugin = spm.get_plugin_by_name('Memory') persistent_object = StoreMixin() persistent_object.open_storage(storage_plugin, 'test') persistent_object[key] = 'à value' assert persistent_object[key] == 'à value' assert key in persistent_object del persistent_object[key] assert key not in persistent_object assert len(persistent_object) == 0
def test_storage(): key = "test" __import__("errbot.config-template") config = ShallowConfig() config.__dict__.update(sys.modules["errbot.config-template"].__dict__) bot_config_defaults(config) spm = BackendPluginManager(config, "errbot.storage", "Memory", StoragePluginBase, CORE_STORAGE) storage_plugin = spm.load_plugin() persistent_object = StoreMixin() persistent_object.open_storage(storage_plugin, "test") persistent_object[key] = "à value" assert persistent_object[key] == "à value" assert key in persistent_object del persistent_object[key] assert key not in persistent_object assert len(persistent_object) == 0
def test_simple_store_retreive(): sm = StoreMixin() sm.open_storage(MemoryStoragePlugin(None), 'ns') sm['toto'] = 'titui' assert sm['toto'] == 'titui'
def test_simple_store_retreive(): sm = StoreMixin() sm.open_storage(MemoryStoragePlugin(None), "ns") sm["toto"] = "titui" assert sm["toto"] == "titui"