def _call(self, args, stdout=None, mockisfile=False):
    'Run the cli with output streams, actual client and optionally\n        os.path.isfile() mocked out'
    if mockisfile:
        orig_open = os.path.isfile

        def mock_isfile(fn, *args, **kwargs):
            'Mock os.path.isfile()'
            if (fn.endswith('cert') or fn.endswith('chain') or fn.endswith('privkey')):
                return True
            return orig_open(fn)
        with mock.patch('certbot.compat.os.path.isfile') as mock_if:
            mock_if.side_effect = mock_isfile
            with mock.patch('certbot._internal.main.client') as client:
                (ret, stdout, stderr) = self._call_no_clientmock(args, stdout)
                return (ret, stdout, stderr, client)
    else:
        with mock.patch('certbot._internal.main.client') as client:
            (ret, stdout, stderr) = self._call_no_clientmock(args, stdout)
            return (ret, stdout, stderr, client)
Run the cli with output streams, actual client and optionally
os.path.isfile() mocked out
def _call(self, args, stdout=None, mockisfile=False):
    'Run the cli with output streams, actual client and optionally\n        os.path.isfile() mocked out'
    if mockisfile:
        orig_open = os.path.isfile

        def mock_isfile(fn, *args, **kwargs):
            'Mock os.path.isfile()'
            if (fn.endswith('cert') or fn.endswith('chain') or fn.endswith('privkey')):
                return True
            return orig_open(fn)
        with mock.patch('certbot.compat.os.path.isfile') as mock_if:
            mock_if.side_effect = mock_isfile
            with mock.patch('certbot._internal.main.client') as client:
                (ret, stdout, stderr) = self._call_no_clientmock(args, stdout)
                return (ret, stdout, stderr, client)
    else:
        with mock.patch('certbot._internal.main.client') as client:
            (ret, stdout, stderr) = self._call_no_clientmock(args, stdout)
            return (ret, stdout, stderr, client)