Exemple #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'])
Exemple #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']])
Exemple #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'])
Exemple #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)
Exemple #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)
Exemple #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']])