Jelajahi Sumber

Update read file unit tests

Cristian Matiut 2 bulan lalu
induk
melakukan
12037348c0

+ 2 - 2
coriolis/tests/osmorphing/test_base.py

@@ -808,7 +808,7 @@ class BaseLinuxOSMorphingToolsTestBase(test_base.CoriolisBaseTestCase):
 
         result = self.os_morphing_tools._read_file_sudo(chroot_path)
 
-        mock_exec_cmd_chroot.assert_called_once_with('cat %s' % chroot_path)
+        mock_exec_cmd_chroot.assert_called_once_with('cat "%s"' % chroot_path)
         self.assertEqual(result, mock_exec_cmd_chroot.return_value)
 
     @mock.patch.object(base.BaseLinuxOSMorphingTools, '_exec_cmd_chroot')
@@ -817,7 +817,7 @@ class BaseLinuxOSMorphingToolsTestBase(test_base.CoriolisBaseTestCase):
 
         result = self.os_morphing_tools._read_file_sudo(chroot_path)
 
-        mock_exec_cmd_chroot.assert_called_once_with('cat /%s' % chroot_path)
+        mock_exec_cmd_chroot.assert_called_once_with('cat "/%s"' % chroot_path)
         self.assertEqual(result, mock_exec_cmd_chroot.return_value)
 
     @mock.patch.object(base.BaseLinuxOSMorphingTools, '_read_file_sudo')

+ 2 - 1
coriolis/tests/providers/test_backup_writers.py

@@ -1325,7 +1325,8 @@ class HTTPBackupWriterBootstrapperTestcase(test_base.CoriolisBaseTestCase):
             mock.sentinel.remote_path)
 
         mock_exec_ssh_cmd.assert_called_once_with(
-            self._ssh, "sudo cat %s" % mock.sentinel.remote_path, get_pty=True)
+            self._ssh, 'sudo cat "%s"' % mock.sentinel.remote_path,
+            get_pty=True)
         self.assertEqual(
             result, mock_exec_ssh_cmd.return_value)