def test_returns_execute_result(self): self.stub__find_command(lambda x:1) self.assertEqual(1, commands.run_argv(['crcache', 'foo'], 'in', 'out', 'err'))
def test_returns_0_when_None_returned_from_execute(self): self.stub__find_command(lambda x:None) self.assertEqual(0, commands.run_argv(['crcache', 'foo'], 'in', 'out', 'err'))
def test_no_cmd_issues_help(self): self.stub__find_command(lambda x:0) commands.run_argv(['crcache', '--version'], 'in', 'out', 'err') self.assertEqual(['help'], self.calls)
def test_runs_cmd_with_CLI_UI(self): self.stub__find_command(self.capture_ui) commands.run_argv(['crcache', '--version', 'foo'], 'in', 'out', 'err') self.assertEqual(['foo'], self.calls) self.assertIsInstance(self.ui, cli.UI)
def test_looks_up_cmd_skips_options(self): self.stub__find_command(lambda x:0) commands.run_argv(['crcache', '--version', 'foo'], 'in', 'out', 'err') self.assertEqual(['foo'], self.calls)