def test_prepare_grub_dir_no_ci_cfg(self): grub_conf = 'etc/default/grub.d/%s' % self.random_string() target_grub_conf = os.path.join(self.target, grub_conf) self.m_path.return_value = False install_grub.prepare_grub_dir(self.target, grub_conf) self.m_ensure_dir.assert_called_with(os.path.dirname(target_grub_conf)) self.assertEqual(0, self.m_move.call_count)
def test_prepare_grub_dir(self): grub_conf = 'etc/default/grub.d/%s' % self.random_string() target_grub_conf = os.path.join(self.target, grub_conf) ci_conf = os.path.join(os.path.dirname(target_grub_conf), '50-cloudimg-settings.cfg') self.m_path.return_value = True install_grub.prepare_grub_dir(self.target, grub_conf) self.m_ensure_dir.assert_called_with(os.path.dirname(target_grub_conf)) self.m_move.assert_called_with(ci_conf, ci_conf + '.disabled')