예제 #1
0
 def test_argument_has_priority_over_option(self):
     command = './greet2 -nJim --name=Joe Jack'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jim,Joe,Jack!')
     self.assertEqual(0, status_code)
예제 #2
0
 def test_long_vs_short_options(self):
     command = './greet2 -nJim --name=Joe'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jim,Joe!')
     self.assertEqual(0, status_code)
예제 #3
0
 def test_greet_jim_with_short_option_with_space(self):
     command = './greet2 -n Jim'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jim!')
     self.assertEqual(0, status_code)
예제 #4
0
 def test_greet_joe_with_long_option(self):
     command = './greet2 --name=Joe'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Joe!')
     self.assertEqual(0, status_code)
예제 #5
0
 def test_greet_with_no_arguments(self):
     command = './greet2'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho(greet2.USAGE)
     self.assertEqual(1, status_code)
예제 #6
0
 def test_greet_jack_with_short_option(self):
     command = './greet2 -nJack'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jack!')
     self.assertEqual(0, status_code)
예제 #7
0
 def test_many_short_options(self):
     command = './greet2 -nJim -nJoe -nJua'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jua!')
     self.assertEqual(0, status_code)
예제 #8
0
 def test_greet_with_no_arguments(self):
     command = './greet2'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho(greet2.USAGE)
     self.assertEqual(1, status_code)
예제 #9
0
 def test_argument_has_priority_over_option(self):
     command = './greet2 -nJim --name=Joe Jack'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jack!')
     self.assertEqual(0, status_code)
예제 #10
0
 def test_long_vs_short_options(self):
     command = './greet2 -nJim --name=Joe'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Joe!')
     self.assertEqual(0, status_code)
예제 #11
0
 def test_greet_joe_with_long_option(self):
     command = './greet2 --name=Joe'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Joe!')
     self.assertEqual(0, status_code)
예제 #12
0
 def test_greet_jim_with_short_option_with_space(self):
     command = './greet2 -n Jim'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jim!')
     self.assertEqual(0, status_code)
예제 #13
0
 def test_greet_jack_with_short_option(self):
     command = './greet2 -nJack'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jack!')
     self.assertEqual(0, status_code)
예제 #14
0
 def test_many_short_options_by_comma(self):
     command = './greet2 -nJim,Joe,Jua'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi Jim,Joe,Jua!')
     self.assertEqual(0, status_code)
예제 #15
0
 def test_greet_john_with_argument(self):
     command = './greet2 John'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi John!')
     self.assertEqual(0, status_code)
예제 #16
0
 def test_no_options(self):
     command = './greet2 -n'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho(greet2.USAGE)
     self.assertEqual(1, status_code)
예제 #17
0
 def test_greet_john_with_argument(self):
     command = './greet2 John'
     argv = command.split()
     status_code = greet2.main(argv)
     self.assertEcho('Hi John!')
     self.assertEqual(0, status_code)