def test_guests_no_params(self): parsed_args = parse_args(["guests"]) self.assertEqual(parsed_args.command, "guests")
def test_guests_with_params(self, mock_stderr): with self.assertRaises(SystemExit) as cm: parse_args(["guests", "fakeparam"]) exit_exception = cm.exception self.assertEqual(exit_exception.code, 2)
def test_import_no_params(self, mock_stderr): with self.assertRaises(SystemExit) as cm: parse_args(["import"]) exit_exception = cm.exception self.assertEqual(exit_exception.code, 2)
def test_reset_no_params(self): parsed_args = parse_args(["reset"]) self.assertEqual(parsed_args.command, "reset")
def test_register_partner_multiple_partner_names(self): parsed_args = parse_args(["register", "John", "-p", "Mike", "Goodman"]) self.assertEqual(parsed_args.command, "register") self.assertEqual(parsed_args.name, ["John"]) self.assertEqual(parsed_args.partner, ["Mike", "Goodman"])
def test_exchange_no_params(self): parsed_args = parse_args(["exchange"]) self.assertEqual(parsed_args.command, "exchange")
def test_register_partner_no_partner(self, mock_stderr): with self.assertRaises(SystemExit) as cm: parse_args(["register", "John", "-p"]) exit_exception = cm.exception self.assertEqual(exit_exception.code, 2)
def test_register_multiple_name(self): parsed_args = parse_args(["register", "John", "Boyer"]) self.assertEqual(parsed_args.command, "register") self.assertEqual(parsed_args.name, ["John", "Boyer"])
def test_import_valid_param(self): parsed_args = parse_args(["import", "fakefile.txt"]) self.assertEqual(parsed_args.command, "import") self.assertEqual(parsed_args.filename, "fakefile.txt")
def test_import_too_many_params(self, mock_stderr): with self.assertRaises(SystemExit) as cm: parse_args(["import", "fakefile1.txt", "fakefile2.txt"]) exit_exception = cm.exception self.assertEqual(exit_exception.code, 2)
def test_no_command(self, mock_stderr): with self.assertRaises(SystemExit) as cm: parse_args([]) exit_exception = cm.exception self.assertEqual(exit_exception.code, 2)