예제 #1
0
 def testNoQuotesCommands(self): #tests user input, sees if it lists the commands present with no quotes
     commands = []
     for process in shell.inputToProcesses('ls | ps aux | du -d 1 -h\n'): 
         commands.append(process.command)
     self.assertEqual(commands, ['ls', 'ps', 'du'])
예제 #2
0
 def testDoubleQuotesArguments(self): #tests user input, sees if it lists the arguments present with double quotes
     arguments = []
     for process in shell.inputToProcesses('ls "Welcome to | the jungle" | ps aux\n'):
         arguments.append(process.arguments)
     self.assertEqual(arguments, [["Welcome to | the jungle"], ['aux']])
예제 #3
0
 def testDoubleQuotesCommands(self): #tests user input, sees if it lists the commands present with double quotes
     commands = []
     for process in shell.inputToProcesses('ls "Welcome to | the jungle" | ps aux\n'): 
         commands.append(process.command)
     self.assertEqual(commands, ['ls', 'ps'])
예제 #4
0
 def testDoubleQuotesProcess(self): #tests user input, sees if it recognizes the amount of processes present with double quotes
     procList = shell.inputToProcesses('ls "Welcome to | the jungle" | ps aux\n')
     self.assertEqual(len(procList), 2)
예제 #5
0
 def testNoQuotesProcess(self): #tests user input, sees if it recognizes the amount of processes present with no quotes
     procList = shell.inputToProcesses('ls | ps aux | du -d 1 -h\n')
     self.assertEqual(len(procList), 3)
예제 #6
0
 def testNoQuotesArguments(self): #tests user input, sees if it lists the arguments present with no quotes
     arguments = []
     for process in shell.inputToProcesses('ls | ps aux | du -d 1 -h\n'): 
         arguments.append(process.arguments)
     self.assertEqual(arguments, [[], ['aux'], ['-d', '1', '-h']])