From 9303d07ba782c77915e85df8e3b375a93421a595 Mon Sep 17 00:00:00 2001 From: kjwon15 Date: Wed, 12 Apr 2017 13:34:50 +0900 Subject: [PATCH] Fix kwargs unit test * Fix typo on testing module's filename. * Fix category on testing message. --- .../{kw_arg_plugin_module.py => kwarg_plugin_module.py} | 1 + tests/unit/test_manager.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) rename tests/unit/{kw_arg_plugin_module.py => kwarg_plugin_module.py} (99%) diff --git a/tests/unit/kw_arg_plugin_module.py b/tests/unit/kwarg_plugin_module.py similarity index 99% rename from tests/unit/kw_arg_plugin_module.py rename to tests/unit/kwarg_plugin_module.py index ba112693..0d3f0d3d 100644 --- a/tests/unit/kw_arg_plugin_module.py +++ b/tests/unit/kwarg_plugin_module.py @@ -1,5 +1,6 @@ from slackbot.bot import respond_to + @respond_to('Hello, (?P.+)') def say_hello(message, name): message.reply('Hello! {}'.format(name)) diff --git a/tests/unit/test_manager.py b/tests/unit/test_manager.py index b78895ed..fa2f875e 100644 --- a/tests/unit/test_manager.py +++ b/tests/unit/test_manager.py @@ -22,10 +22,10 @@ def test_kwargs(): pm._load_plugins('kwarg_plugin_module') msg = { - 'category': 'default_reply', + 'category': 'respond_to', 'text': 'Hello, Jeong Arm', } - func, args, kwargs = pm.get_plugins(msg['category'], msg['text']) - assert args == () + func, args, kwargs = next(pm.get_plugins(msg['category'], msg['text'])) + assert not args assert kwargs == {'name': 'Jeong Arm'}