kiwi-el8/test/unit/utils_block_test.py
Marcus Schäfer 3ddc4326c8
Added BlockID class
Class to provide support for retrieving block device metadata
2016-09-22 15:18:42 +02:00

35 lines
990 B
Python

from mock import patch
import mock
from .test_helper import *
from kiwi.utils.block import BlockID
class TestBlockID(object):
def setup(self):
self.blkid = BlockID('device')
@patch('kiwi.utils.block.Command.run')
def test_get_blkid(self, mock_command):
self.blkid.get_blkid('LABEL')
mock_command.assert_called_once_with(
['blkid', 'device', '-s', 'LABEL', '-o', 'value']
)
@patch('kiwi.utils.block.BlockID.get_blkid')
def test_get_filesystem(self, mock_get_blkid):
self.blkid.get_filesystem()
mock_get_blkid.assert_called_once_with('TYPE')
@patch('kiwi.utils.block.BlockID.get_blkid')
def test_get_label(self, mock_get_blkid):
self.blkid.get_label()
mock_get_blkid.assert_called_once_with('LABEL')
@patch('kiwi.utils.block.BlockID.get_blkid')
def test_get_uuid(self, mock_get_blkid):
self.blkid.get_uuid()
mock_get_blkid.assert_called_once_with('UUID')