def test_delete_learnf_no_file(self): config = RedisStorageConfiguration() engine = RedisStorageEngine(config) engine.initialise() store = RedisLearnfStore(engine) test_client = TestClient() client_context = test_client.create_client_context("test1") store.delete_learnf(client_context)
def test_save_learnf_same_pattern(self): config = RedisStorageConfiguration() engine = RedisStorageEngine(config) engine.initialise() store = RedisLearnfStore(engine) test_client = TestClient() client_context = test_client.create_client_context("test1") pattern = ET.Element('pattern') pattern.text = "HELLO" topic = ET.Element('topic') topic.text = '*' that = ET.Element('that') that.text = '*' template = TemplateNode() template.append(TemplateWordNode("Hello")) category = LearnCategory(pattern, topic, that, template) is_replace = False store.save_learnf(client_context, category, is_replace) is_replace = True store.save_learnf(client_context, category, is_replace)
def learnf_store(self): return RedisLearnfStore(self)
def test_initialise(self): config = RedisStorageConfiguration() engine = RedisStorageEngine(config) engine.initialise() store = RedisLearnfStore(engine) self.assertEqual(store.storage_engine, engine)