def test_tuned(): """ Test to manage options of block device """ name = "/dev/vg/master-data" ret = {"name": name, "result": True, "changes": {}, "comment": ""} comt = ("Changes to {} cannot be applied. Not a block device. ").format(name) with patch.dict(blockdev.__salt__, {"file.is_blkdev": False}): ret.update({"comment": comt}) assert blockdev.tuned(name) == ret comt = "Changes to {} will be applied ".format(name) with patch.dict(blockdev.__salt__, {"file.is_blkdev": True}): ret.update({"comment": comt, "result": None}) with patch.dict(blockdev.__opts__, {"test": True}): assert blockdev.tuned(name) == ret
def test_tuned(self): ''' Test to manage options of block device ''' name = '/dev/vg/master-data' ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} comt = ('Changes to {0} cannot be applied. ' 'Not a block device. ').format(name) with patch.dict(blockdev.__salt__, {'file.is_blkdev': False}): ret.update({'comment': comt}) self.assertDictEqual(blockdev.tuned(name), ret) comt = ('Changes to {0} will be applied '.format(name)) with patch.dict(blockdev.__salt__, {'file.is_blkdev': True}): ret.update({'comment': comt, 'result': None}) with patch.dict(blockdev.__opts__, {'test': True}): self.assertDictEqual(blockdev.tuned(name), ret)