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