Esempio n. 1
0
#!/usr/bin/env python

import unittest
import os

from __armando__ import Armando

###
Armando.initialize()
###

from config import Config

class TestTakkRules(unittest.TestCase):
    __dummy_file = 'test_action_dummy_file'

    def setUp(self):
        Config.get_config('conf/main.test.conf')
        from rules import Rules
        self.rules = Rules('conf/speech.test.xml')

    def test_pattern_matched(self):
        patterns = self.rules.pattern_match('play some music artist Led Zeppelin')
        self.assertGreater(len(patterns), 0)
        self.assertEqual(patterns[0]['id'], 'play-music')
        self.assertEqual(patterns[0]['attributes']['artist'], 'Led Zeppelin')

    def test_pattern_not_matched(self):
        patterns = self.rules.pattern_match('this will never be matched by any of my rules')
        self.assertEqual(len(patterns), 0)