def test_handle_keyword_in_command(self): action = TestAction() actionbase.KeywordHandler('FooBar', action).handle('frobnicate the foobar') self.assertEqual(action.voice_command, 'frobnicate the foobar')
def test_handle_keyword_with_mixed_case(self): action = TestAction() actionbase.KeywordHandler('FooBar', action).handle('foobar') self.assertEqual(action.voice_command, 'foobar')
def test_can_handle_does_nothing(self): action = TestAction() actionbase.KeywordHandler('FooBar', action).can_handle('frobnicate the foobar') self.assertIsNone(action.voice_command)
def test_keyword_phrases(self): phrases = actionbase.KeywordHandler('FooBar', None).get_phrases() self.assertEqual(phrases, ['foobar'])
def test_can_handle_returns_true(self): action = TestAction() handler = actionbase.KeywordHandler('FooBar', action) self.assertTrue(handler.can_handle('frobnicate the foobar'))