def test_resize(self): ''' Test if it resize filesystem. ''' mock = MagicMock(return_value={'retcode': 1, 'stderr': '', 'stdout': 'Salt'}) mock_info = MagicMock(return_value=[]) with patch.dict(btrfs.__salt__, {'cmd.run_all': mock, 'btrfs.info': mock_info}): mock = MagicMock(return_value={'/dev/sda1': True}) with patch.object(salt.utils.fsutils, '_get_mounts', mock): self.assertDictEqual(btrfs.resize('/dev/sda1', 'max'), {'log': 'Salt'})
def test_resize(self): """ Test if it resize filesystem. """ with patch("salt.utils.fsutils._is_device", MagicMock(return_value=True)): mock = MagicMock( return_value={"retcode": 1, "stderr": "", "stdout": "Salt"} ) mock_info = MagicMock(return_value=[]) with patch.dict( btrfs.__salt__, {"cmd.run_all": mock, "btrfs.info": mock_info} ): mock = MagicMock(return_value={"/dev/sda1": True}) with patch.object(salt.utils.fsutils, "_get_mounts", mock): self.assertDictEqual( btrfs.resize("/dev/sda1", "max"), {"log": "Salt"} )