示例#1
0
    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)
示例#2
0
    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)
示例#3
0
 def learnf_store(self):
     return RedisLearnfStore(self)
示例#4
0
 def test_initialise(self):
     config = RedisStorageConfiguration()
     engine = RedisStorageEngine(config)
     engine.initialise()
     store = RedisLearnfStore(engine)
     self.assertEqual(store.storage_engine, engine)