def test_echo_command(self): test_command = ['sudo', 'rm', '-rf', '/tmp/*'] mock_stream = MagicMock() shell._echo_command(test_command, mock_stream) mock_stream.write.assert_called_with('>>> {}\n'.format( shell.quote(test_command))) assert (mock_stream.flush.called)
def test_quote_iterable(self): self.assertEqual(shell.quote(['rm', '-rf', '~/Documents/My Homework']), "rm -rf '~/Documents/My Homework'")
def test_quote_string(self): self.assertEqual(shell.quote('/Applications/App Store.app'), "'/Applications/App Store.app'")