Skip to content

Commit 67f6347

Browse files
committed
Update coriolis.osmorphing.base unit tests
1 parent 2615ece commit 67f6347

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

coriolis/tests/osmorphing/test_base.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def setUp(self):
132132
self.conn = mock.sentinel.conn
133133
self.os_root_dir = '/root'
134134
self.chroot_path = '/root/etc/resolv.conf'
135+
self.joined_chroot_path = '/root/root/etc/resolv.conf'
135136
self.os_root_device = mock.sentinel.os_root_device
136137
self.hypervisor = mock.sentinel.hypervisor
137138
self.event_manager = mock.MagicMock()
@@ -288,45 +289,33 @@ def test_get_update_grub2_command(self):
288289
def test__test_path(self, mock_test_ssh_path):
289290
result = self.os_morphing_tools._test_path(self.chroot_path)
290291

291-
mocked_full_path = os.path.join(
292-
self.os_morphing_tools._os_root_dir, self.chroot_path)
293-
294292
mock_test_ssh_path.assert_called_once_with(
295-
self.os_morphing_tools._ssh, mocked_full_path)
293+
self.os_morphing_tools._ssh, self.joined_chroot_path)
296294
self.assertEqual(result, mock_test_ssh_path.return_value)
297295

298296
@mock.patch.object(base.utils, 'read_ssh_file')
299297
def test__read_file(self, mock_read_ssh_file):
300298
result = self.os_morphing_tools._read_file(self.chroot_path)
301299

302-
mocked_full_path = os.path.join(
303-
self.os_morphing_tools._os_root_dir, self.chroot_path)
304-
305300
mock_read_ssh_file.assert_called_once_with(
306-
self.os_morphing_tools._ssh, mocked_full_path)
301+
self.os_morphing_tools._ssh, self.joined_chroot_path)
307302
self.assertEqual(result, mock_read_ssh_file.return_value)
308303

309304
@mock.patch.object(base.utils, 'write_ssh_file')
310305
def test__write_file(self, mock_write_ssh_file):
311306
self.os_morphing_tools._write_file(
312307
self.chroot_path, mock.sentinel.content)
313308

314-
mocked_full_path = os.path.join(
315-
self.os_morphing_tools._os_root_dir, self.chroot_path)
316-
317309
mock_write_ssh_file.assert_called_once_with(
318-
self.os_morphing_tools._ssh, mocked_full_path,
310+
self.os_morphing_tools._ssh, self.joined_chroot_path,
319311
mock.sentinel.content)
320312

321313
@mock.patch.object(base.utils, 'list_ssh_dir')
322314
def test__list_dir(self, mock_list_ssh_dir):
323315
result = self.os_morphing_tools._list_dir(self.chroot_path)
324316

325-
mocked_full_path = os.path.join(
326-
self.os_morphing_tools._os_root_dir, self.chroot_path)
327-
328317
mock_list_ssh_dir.assert_called_once_with(
329-
self.os_morphing_tools._ssh, mocked_full_path)
318+
self.os_morphing_tools._ssh, self.joined_chroot_path)
330319
self.assertEqual(result, mock_list_ssh_dir.return_value)
331320

332321
@mock.patch.object(base.utils, 'exec_ssh_cmd')

0 commit comments

Comments
 (0)