Skip to content

Commit

Permalink
Add tiny bit of tests to the storage tests (New) (#1004)
Browse files Browse the repository at this point in the history
* add tiny bit of tests to the storage tests

* add psutil to the base prov. tox.ini

* add psutil also for py36
  • Loading branch information
kissiel authored Mar 18, 2024
1 parent 9f06381 commit 3991a48
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions providers/base/tests/test_storage_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import unittest
from unittest.mock import patch, MagicMock


from storage_test import mountpoint

class TestMountpoint(unittest.TestCase):
@patch("psutil.disk_partitions")
def test_mountpoint_nominal(self, mock_disk_partitions):

sdiskpart = MagicMock()
sdiskpart.device = '/dev/sda1'
sdiskpart.mountpoint = '/'
mock_disk_partitions.return_value = [sdiskpart]
self.assertEqual(mountpoint("/dev/sda1"), "/")

@patch("psutil.disk_partitions")
def test_mountpoint_nominal_multiple(self, mock_disk_partitions):

mock_disk_partitions.return_value = [
MagicMock(device='/dev/sda1', mountpoint='/'),
MagicMock(device='/dev/sda2', mountpoint='/boot')
]
self.assertEqual(mountpoint("/dev/sda2"), "/boot")


@patch("psutil.disk_partitions")
def test_mountpoint_empty(self, mock_disk_partitions):
mock_disk_partitions.return_value = []
self.assertEqual(mountpoint('/dev/sda1'), None)
2 changes: 2 additions & 0 deletions providers/base/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ deps =
MarkupSafe == 0.23
natsort == 4.0.3
opencv_python == 4.4.0.42
psutil == 5.9.5
requests == 2.9.1
tqdm == 4.19.5
urwid == 1.3.1
Expand All @@ -48,6 +49,7 @@ deps =
MarkupSafe == 1.1.0
natsort == 4.0.3
opencv_python == 4.4.0.42
psutil == 5.9.5
requests == 2.18.4
tqdm == 4.19.5
urwid == 2.0.1
Expand Down

0 comments on commit 3991a48

Please sign in to comment.