Beispiel #1
0
    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)
Beispiel #2
0
 def test_quote_iterable(self):
     self.assertEqual(shell.quote(['rm', '-rf', '~/Documents/My Homework']),
                      "rm -rf '~/Documents/My Homework'")
Beispiel #3
0
 def test_quote_string(self):
     self.assertEqual(shell.quote('/Applications/App Store.app'),
                      "'/Applications/App Store.app'")