Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests fstools #138

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions probert/tests/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ async def test_expected_output_vg(self):
assert expected == await get_swap_sizing(device)


@patch('probert.filesystem.shutil.which', new=Mock(return_value='/bin/false'))
class TestFilesystem(IsolatedAsyncioTestCase):
def setUp(self):
self.device = Mock()
Expand Down Expand Up @@ -196,17 +197,17 @@ async def test_get_device_filesystem_sizing_ext4_no_min(self):
actual = await get_device_filesystem(self.device, True)
self.assertEqual(expected, actual)

@patch('probert.filesystem.shutil.which')
async def test_ntfsresize_not_found(self, which):
which.return_value = None

@patch('probert.filesystem.shutil.which', new=Mock(return_value=None))
class TestFilesystemToolNotFound(IsolatedAsyncioTestCase):
def setUp(self):
self.device = Mock()

async def test_ntfsresize_not_found(self):
self.assertEqual(None, await get_ntfs_sizing(self.device))

@patch('probert.filesystem.shutil.which')
async def test_dumpe2fs_not_found(self, which):
which.return_value = None
async def test_dumpe2fs_not_found(self):
self.assertEqual(None, await get_dumpe2fs_info(self.device))

@patch('probert.filesystem.shutil.which')
async def test_resize2fs_not_found(self, which):
which.return_value = None
async def test_resize2fs_not_found(self):
self.assertEqual(None, await get_resize2fs_info(self.device))
9 changes: 8 additions & 1 deletion probert/tests/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

import subprocess
from unittest import IsolatedAsyncioTestCase
from unittest.mock import patch
from unittest.mock import Mock, patch

from probert.os import probe, _parse_osprober, _run_os_prober


@patch('probert.filesystem.shutil.which', new=Mock(return_value='/bin/false'))
class TestOsProber(IsolatedAsyncioTestCase):
def tearDown(self):
_run_os_prober.cache_clear()
Expand Down Expand Up @@ -154,3 +155,9 @@ async def test_run_once(self, run):
self.assertEqual({}, await probe())
self.assertEqual({}, await probe())
run.assert_called_once()


@patch('probert.filesystem.shutil.which', new=Mock(return_value=None))
class TestOsProberNotFound(IsolatedAsyncioTestCase):
async def test_os_prober_not_found(self):
self.assertEqual(None, _run_os_prober())
Loading