Example #1
0
 def test_guests_no_params(self):
     parsed_args = parse_args(["guests"])
     self.assertEqual(parsed_args.command, "guests")
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 def test_reset_no_params(self):
     parsed_args = parse_args(["reset"])
     self.assertEqual(parsed_args.command, "reset")
Example #5
0
 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"])
Example #6
0
 def test_exchange_no_params(self):
     parsed_args = parse_args(["exchange"])
     self.assertEqual(parsed_args.command, "exchange")
Example #7
0
 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)
Example #8
0
 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"])
Example #9
0
 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")
Example #10
0
 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)
Example #11
0
 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)