@mock.patch.object(utils, '_check_dir_writable', autospec=True)
@mock.patch.object(utils, '_check_dir_free_space', autospec=True)
def test_check_dir_ok(self, mock_free_space, mock_dir_writable):
    self.config(tempdir='/fake/path')
    with mock.patch.object(os.path, 'exists', autospec=True) as mock_exists:
        mock_exists.return_value = True
        utils.check_dir()
        mock_exists.assert_called_once_with(CONF.tempdir)
    mock_dir_writable.assert_called_once_with(CONF.tempdir)
    mock_free_space.assert_called_once_with(CONF.tempdir, 1)
@mock.patch.object(utils, '_check_dir_writable', autospec=True)
@mock.patch.object(utils, '_check_dir_free_space', autospec=True)
def test_check_dir_ok(self, mock_free_space, mock_dir_writable):
    self.config(tempdir='/fake/path')
    with mock.patch.object(os.path, 'exists', autospec=True) as mock_exists:
        mock_exists.return_value = True
        utils.check_dir()
        mock_exists.assert_called_once_with(CONF.tempdir)
    mock_dir_writable.assert_called_once_with(CONF.tempdir)
    mock_free_space.assert_called_once_with(CONF.tempdir, 1)