def test_loads_file_specified_on_command_line(self, mock_parser, mock_load_file): mock_parser.parse_args.return_value = mock_options = Mock() mock_options.modulename = sentinel.modulename mock_options.gui = "gtk" mock_load_file.return_value = OurMainModule with patched("twisted.internet", "reactor"): main() assert mock_load_file.call_args_list == [((sentinel.modulename,), {})]
def test_blows_up_on_bad_gui(self, our_stderr): our_module = Mock() our_module.return_value = Mock() with patched('pymudclient.mudconnect', 'load_file', our_module): try: main() except SystemExit: err_string = our_stderr.write.call_args[0][0] print err_string assert "invalid choice: 'flarg'" in err_string else: assert False