def test_add(self): """ Application.add() and .addCommands() register commands """ application = Application() foo = FooCommand() application.add(foo) self.assertEqual(foo, application.all()["foo:bar"], msg=".add() registers a command") application = Application() foo, foo1 = FooCommand(), Foo1Command() application.add_commands([foo, foo1]) commands = application.all() self.assertEqual( [foo, foo1], [commands["foo:bar"], commands["foo:bar1"]], msg=".add_commands() registers a list of commands" )
def test_add(self): """ Application.add() and .addCommands() register commands """ application = Application() foo = FooCommand() application.add(foo) self.assertEqual(foo, application.all()['foo:bar'], msg='.add() registers a command') application = Application() foo, foo1 = FooCommand(), Foo1Command() application.add_commands([foo, foo1]) commands = application.all() self.assertEqual([foo, foo1], [commands['foo:bar'], commands['foo:bar1']], msg='.add_commands() registers a list of commands')