示例#1
0
 def test_parse_no_args_request(self):
     parsed_request = RequestParser('ls;')
     self.assertEqual(parsed_request.command, 'ls')
     self.assertEqual(parsed_request.args, '')
     self.assertTrue(parsed_request.is_valid)
示例#2
0
 def test_custom_delimiter(self):
     parsed_request = RequestParser('ls,/home/pepe/', ',')
     self.assertEqual(parsed_request.command, 'ls')
     self.assertEqual(parsed_request.args, '/home/pepe/')
示例#3
0
 def test_parse_invalid_request(self):
     parsed_request = RequestParser(';')
     self.assertFalse(parsed_request.is_valid)
示例#4
0
 def test_parse_empty_request(self):
     parsed_request = RequestParser('')
     self.assertFalse(parsed_request.is_valid)
示例#5
0
 def test_parse_spaced_args(self):
     parsed_request = RequestParser('ls;/home/pepe something/')
     self.assertEqual(parsed_request.command, 'ls')
     self.assertEqual(parsed_request.args, '/home/pepe something/')
     self.assertTrue(parsed_request.is_valid)
示例#6
0
 def test_parse_valid_request(self):
     parsed_request = RequestParser('ls;/home/pepe/')
     self.assertEqual(parsed_request.command, 'ls')
     self.assertEqual(parsed_request.args, '/home/pepe/')
     self.assertTrue(parsed_request.is_valid)