我正在尝试完成我正在编写的 errbot 插件的单元测试。谁能告诉我如何模拟一个方法使用的辅助botcmd
方法?
例子:
class ChatBot(BotPlugin):
@classmethod
def mycommandhelper(cls):
return 'This is my awesome commandz'
@botcmd
def mycommand(self, message, args):
return self.mycommandhelper()
执行我的命令类时如何模拟 mycommandhelper 类?在我的例子中,这个类正在执行一些在单元测试期间不应该执行的远程操作。