def test_set_run_custom_default_command(self): """ Application calls the default command. """ application = Application() application.set_auto_exit(False) command = FooCommand() application.add(command) application.set_default_command(command.get_name()) tester = ApplicationTester(application) tester.run([]) self.assertEqual( 'interact called\ncalled\n', tester.get_display() ) application = CustomDefaultCommandApplication() application.set_auto_exit(False) tester = ApplicationTester(application) tester.run([]) self.assertEqual( 'interact called\ncalled\n', tester.get_display() )
def test_set_run_custom_single_command(self): command = FooCommand() application = Application() application.set_auto_exit(False) application.add(command) application.set_default_command(command.get_name(), True) tester = ApplicationTester(application) tester.run([]) self.assertIn('called', tester.get_display()) tester.run([('--help', True)]) self.assertIn('The foo:bar command', tester.get_display())
def test_set_run_custom_default_command(self): """ Application calls the default command. """ application = Application() application.set_auto_exit(False) command = FooCommand() application.add(command) application.set_default_command(command.get_name()) tester = ApplicationTester(application) tester.run([]) self.assertEqual("interact called\ncalled\n", tester.get_display()) application = CustomDefaultCommandApplication() application.set_auto_exit(False) tester = ApplicationTester(application) tester.run([]) self.assertEqual("interact called\ncalled\n", tester.get_display())