The following issues were found
certbot-apache/tests/display_ops_test.py
17 issues
Line: 9
Column: 1
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from certbot import errors
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot_apache._internal import obj
from certbot_apache._internal.display_ops import select_vhost_multiple
import util
Reported by Pylint.
Line: 10
Column: 1
from unittest import mock # type: ignore
from certbot import errors
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot_apache._internal import obj
from certbot_apache._internal.display_ops import select_vhost_multiple
import util
Reported by Pylint.
Line: 11
Column: 1
from certbot import errors
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot_apache._internal import obj
from certbot_apache._internal.display_ops import select_vhost_multiple
import util
Reported by Pylint.
Line: 12
Column: 1
from certbot import errors
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot_apache._internal import obj
from certbot_apache._internal.display_ops import select_vhost_multiple
import util
class SelectVhostMultiTest(unittest.TestCase):
Reported by Pylint.
Line: 13
Column: 1
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot_apache._internal import obj
from certbot_apache._internal.display_ops import select_vhost_multiple
import util
class SelectVhostMultiTest(unittest.TestCase):
"""Tests for certbot_apache._internal.display_ops.select_vhost_multiple."""
Reported by Pylint.
Line: 57
Column: 9
@classmethod
def _call(cls, vhosts):
from certbot_apache._internal.display_ops import select_vhost
return select_vhost("example.com", vhosts)
@certbot_util.patch_display_util()
def test_successful_choice(self, mock_util):
mock_util().menu.return_value = (display_util.OK, 3)
Reported by Pylint.
Line: 25
Column: 5
self.vhosts = util.get_vh_truth(
self.base_dir, "debian_apache_2_4/multiple_vhosts")
def test_select_no_input(self):
self.assertFalse(select_vhost_multiple([]))
@certbot_util.patch_display_util()
def test_select_correct(self, mock_util):
mock_util().checklist.return_value = (
Reported by Pylint.
Line: 29
Column: 5
self.assertFalse(select_vhost_multiple([]))
@certbot_util.patch_display_util()
def test_select_correct(self, mock_util):
mock_util().checklist.return_value = (
display_util.OK, [self.vhosts[3].display_repr(),
self.vhosts[2].display_repr()])
vhs = select_vhost_multiple([self.vhosts[3],
self.vhosts[2],
Reported by Pylint.
Line: 41
Column: 5
self.assertFalse(self.vhosts[1] in vhs)
@certbot_util.patch_display_util()
def test_select_cancel(self, mock_util):
mock_util().checklist.return_value = (display_util.CANCEL, "whatever")
vhs = select_vhost_multiple([self.vhosts[2], self.vhosts[3]])
self.assertFalse(vhs)
Reported by Pylint.
Line: 57
Column: 9
@classmethod
def _call(cls, vhosts):
from certbot_apache._internal.display_ops import select_vhost
return select_vhost("example.com", vhosts)
@certbot_util.patch_display_util()
def test_successful_choice(self, mock_util):
mock_util().menu.return_value = (display_util.OK, 3)
Reported by Pylint.
certbot-compatibility-test/certbot_compatibility_test/validator_test.py
17 issues
Line: 8
Column: 1
import OpenSSL
import requests
from acme import errors as acme_errors
from certbot_compatibility_test import validator
class ValidatorTest(unittest.TestCase):
def setUp(self):
Reported by Pylint.
Line: 12
Column: 1
from certbot_compatibility_test import validator
class ValidatorTest(unittest.TestCase):
def setUp(self):
self.validator = validator.Validator()
@mock.patch(
"certbot_compatibility_test.validator.crypto_util.probe_sni")
Reported by Pylint.
Line: 18
Column: 5
@mock.patch(
"certbot_compatibility_test.validator.crypto_util.probe_sni")
def test_certificate_success(self, mock_probe_sni):
cert = OpenSSL.crypto.X509()
mock_probe_sni.return_value = cert
self.assertTrue(self.validator.certificate(
cert, "test.com", "127.0.0.1"))
Reported by Pylint.
Line: 26
Column: 5
@mock.patch(
"certbot_compatibility_test.validator.crypto_util.probe_sni")
def test_certificate_error(self, mock_probe_sni):
cert = OpenSSL.crypto.X509()
mock_probe_sni.side_effect = [acme_errors.Error]
self.assertFalse(self.validator.certificate(
cert, "test.com", "127.0.0.1"))
Reported by Pylint.
Line: 34
Column: 5
@mock.patch(
"certbot_compatibility_test.validator.crypto_util.probe_sni")
def test_certificate_failure(self, mock_probe_sni):
cert = OpenSSL.crypto.X509()
cert.set_serial_number(1337)
mock_probe_sni.return_value = OpenSSL.crypto.X509()
self.assertFalse(self.validator.certificate(
cert, "test.com", "127.0.0.1"))
Reported by Pylint.
Line: 42
Column: 5
cert, "test.com", "127.0.0.1"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
def test_successful_redirect(self, mock_get_request):
mock_get_request.return_value = create_response(
301, {"location": "https://test.com"})
self.assertTrue(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
Reported by Pylint.
Line: 48
Column: 5
self.assertTrue(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
def test_redirect_with_headers(self, mock_get_request):
mock_get_request.return_value = create_response(
301, {"location": "https://test.com"})
self.assertTrue(self.validator.redirect(
"test.com", headers={"Host": "test.com"}))
Reported by Pylint.
Line: 55
Column: 5
"test.com", headers={"Host": "test.com"}))
@mock.patch("certbot_compatibility_test.validator.requests.get")
def test_redirect_missing_location(self, mock_get_request):
mock_get_request.return_value = create_response(301)
self.assertFalse(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
def test_redirect_wrong_status_code(self, mock_get_request):
Reported by Pylint.
Line: 60
Column: 5
self.assertFalse(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
def test_redirect_wrong_status_code(self, mock_get_request):
mock_get_request.return_value = create_response(
201, {"location": "https://test.com"})
self.assertFalse(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
Reported by Pylint.
Line: 66
Column: 5
self.assertFalse(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
def test_redirect_wrong_redirect_code(self, mock_get_request):
mock_get_request.return_value = create_response(
303, {"location": "https://test.com"})
self.assertFalse(self.validator.redirect("test.com"))
@mock.patch("certbot_compatibility_test.validator.requests.get")
Reported by Pylint.
windows-installer/windows_installer/construct.py
17 issues
Line: 139
Column: 9
try:
subprocess.check_output(['choco', '--version'])
except subprocess.CalledProcessError:
raise RuntimeError('Error: Chocolatey (https://chocolatey.org/) needs '
'to be installed to run this script.')
script_path = os.path.realpath(__file__)
repo_path = os.path.dirname(os.path.dirname(os.path.dirname(script_path)))
build_path = os.path.join(repo_path, 'windows-installer', 'build')
venv_path = os.path.join(build_path, 'venv-config')
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import ctypes
import os
import shutil
import struct
import subprocess
import sys
import time
Reported by Pylint.
Line: 6
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import shutil
import struct
import subprocess
import sys
import time
PYTHON_VERSION = (3, 8, 9)
PYTHON_BITNESS = 32
Reported by Bandit.
Line: 15
Column: 1
NSIS_VERSION = '3.06.1'
def main():
if os.name != 'nt':
raise RuntimeError('This script must be run under Windows.')
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
# Administrator privileges are required to properly install NSIS through Chocolatey
Reported by Pylint.
Line: 46
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
def _build_installer(installer_cfg_path):
print('Build the installer')
subprocess.check_call([sys.executable, '-m', 'nsist', installer_cfg_path])
def _compile_wheels(repo_path, build_path, venv_python):
print('Compile wheels')
Reported by Bandit.
Line: 57
Column: 1
certbot_packages = ['acme', 'certbot']
# Uncomment following line to include all DNS plugins in the installer
# certbot_packages.extend([name for name in os.listdir(repo_path) if name.startswith('certbot-dns-')])
wheels_project = [os.path.join(repo_path, package) for package in certbot_packages]
constraints_file_path = os.path.join(repo_path, 'tools', 'requirements.txt')
env = os.environ.copy()
env['PIP_CONSTRAINT'] = constraints_file_path
Reported by Pylint.
Line: 65
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
env['PIP_CONSTRAINT'] = constraints_file_path
command = [venv_python, '-m', 'pip', 'wheel', '-w', wheels_path]
command.extend(wheels_project)
subprocess.check_call(command, env=env)
def _prepare_build_tools(venv_path, venv_python, repo_path):
print('Prepare build tools')
subprocess.check_call([sys.executable, '-m', 'venv', venv_path])
Reported by Bandit.
Line: 70
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
def _prepare_build_tools(venv_path, venv_python, repo_path):
print('Prepare build tools')
subprocess.check_call([sys.executable, '-m', 'venv', venv_path])
subprocess.check_call([venv_python, os.path.join(repo_path, 'tools', 'pipstrap.py')])
subprocess.check_call(['choco', 'upgrade', '--allow-downgrade', '-y', 'nsis', '--version', NSIS_VERSION])
def _copy_assets(build_path, repo_path):
Reported by Bandit.
Line: 71
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
def _prepare_build_tools(venv_path, venv_python, repo_path):
print('Prepare build tools')
subprocess.check_call([sys.executable, '-m', 'venv', venv_path])
subprocess.check_call([venv_python, os.path.join(repo_path, 'tools', 'pipstrap.py')])
subprocess.check_call(['choco', 'upgrade', '--allow-downgrade', '-y', 'nsis', '--version', NSIS_VERSION])
def _copy_assets(build_path, repo_path):
print('Copy assets')
Reported by Bandit.
Line: 72
Column: 1
print('Prepare build tools')
subprocess.check_call([sys.executable, '-m', 'venv', venv_path])
subprocess.check_call([venv_python, os.path.join(repo_path, 'tools', 'pipstrap.py')])
subprocess.check_call(['choco', 'upgrade', '--allow-downgrade', '-y', 'nsis', '--version', NSIS_VERSION])
def _copy_assets(build_path, repo_path):
print('Copy assets')
if os.path.exists(build_path):
Reported by Pylint.
certbot-apache/tests/util.py
17 issues
Line: 6
Column: 1
import sys
import unittest
import augeas
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
Reported by Pylint.
Line: 7
Column: 1
import unittest
import augeas
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
Reported by Pylint.
Line: 14
Column: 1
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
Reported by Pylint.
Line: 15
Column: 1
from unittest import mock # type: ignore
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
Reported by Pylint.
Line: 16
Column: 1
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
Reported by Pylint.
Line: 17
Column: 1
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
Reported by Pylint.
Line: 18
Column: 1
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
class ApacheTest(unittest.TestCase):
Reported by Pylint.
Line: 19
Column: 1
from certbot.tests import util as test_util
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
class ApacheTest(unittest.TestCase):
Reported by Pylint.
Line: 20
Column: 1
from certbot.display import util as display_util
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
class ApacheTest(unittest.TestCase):
def setUp(self, test_dir="debian_apache_2_4/multiple_vhosts",
Reported by Pylint.
Line: 72
Column: 9
vhost_root="debian_apache_2_4/multiple_vhosts/apache2/sites-available"):
super().setUp(test_dir, config_root, vhost_root)
from certbot_apache._internal.parser import ApacheParser
self.aug = augeas.Augeas(
flags=augeas.Augeas.NONE | augeas.Augeas.NO_MODL_AUTOLOAD)
with mock.patch("certbot_apache._internal.parser.ApacheParser."
"update_runtime_variables"):
self.parser = ApacheParser(
Reported by Pylint.
certbot/certbot/reverter.py
17 issues
Line: 201
Column: 1
Read the file returning the lines, and a pointer to the end of the file.
"""
# pylint: disable=consider-using-with
# Open up filepath differently depending on if it already exists
if os.path.isfile(filepath):
op_fd = open(filepath, "r+")
lines = op_fd.read().splitlines()
else:
Reported by Pylint.
Line: 84
Column: 17
"Incomplete or failed recovery for %s",
self.config.temp_checkpoint_dir,
)
raise errors.ReverterError("Unable to revert temporary config")
def rollback_checkpoints(self, rollback=1):
"""Revert 'rollback' number of configuration checkpoints.
:param int rollback: Number of checkpoints to reverse. A str num will be
Reported by Pylint.
Line: 101
Column: 13
rollback = int(rollback)
except ValueError:
logger.error("Rollback argument must be a positive integer")
raise errors.ReverterError("Invalid Input")
# Sanity check input
if rollback < 0:
logger.error("Rollback argument must be a positive integer")
raise errors.ReverterError("Invalid Input")
Reported by Pylint.
Line: 124
Column: 17
self._recover_checkpoint(cp_dir)
except errors.ReverterError:
logger.critical("Failed to load checkpoint during rollback")
raise errors.ReverterError(
"Unable to load checkpoint during rollback")
rollback -= 1
def add_to_temp_checkpoint(self, save_files, save_notes):
"""Add files to temporary checkpoint.
Reported by Pylint.
Line: 186
Column: 21
logger.error(
"Unable to add file %s to checkpoint %s",
filename, cp_dir)
raise errors.ReverterError(
"Unable to add file {0} to checkpoint "
"{1}".format(filename, cp_dir))
idx += 1
op_fd.close()
Reported by Pylint.
Line: 238
Column: 17
except (IOError, OSError):
# This file is required in all checkpoints.
logger.error("Unable to recover files from %s", cp_dir)
raise errors.ReverterError(
"Unable to recover files from %s" % cp_dir)
# Remove any newly added files if they exist
self._remove_contained_files(os.path.join(cp_dir, "NEW_FILES"))
Reported by Pylint.
Line: 248
Column: 13
shutil.rmtree(cp_dir)
except OSError:
logger.error("Unable to remove directory: %s", cp_dir)
raise errors.ReverterError(
"Unable to remove directory: %s" % cp_dir)
def _run_undo_commands(self, filepath):
"""Run all commands in a file."""
# NOTE: csv module uses native strings. That is unicode on Python 3
Reported by Pylint.
Line: 329
Column: 13
new_fd.write("{0}\n".format(path))
except (IOError, OSError):
logger.error("Unable to register file creation(s) - %s", files)
raise errors.ReverterError(
"Unable to register file creation(s) - {0}".format(files))
finally:
if new_fd is not None:
new_fd.close()
Reported by Pylint.
Line: 362
Column: 13
csvwriter.writerow(command)
except (IOError, OSError):
logger.error("Unable to register undo command")
raise errors.ReverterError(
"Unable to register undo command.")
def _get_cp_dir(self, temporary):
"""Return the proper reverter directory."""
if temporary:
Reported by Pylint.
Line: 401
Column: 17
logger.critical("Incomplete or failed recovery for IN_PROGRESS "
"checkpoint - %s",
self.config.in_progress_dir)
raise errors.ReverterError(
"Incomplete or failed recovery for IN_PROGRESS checkpoint "
"- %s" % self.config.in_progress_dir)
def _remove_contained_files(self, file_list):
"""Erase all files contained within file_list.
Reported by Pylint.
certbot-apache/tests/parsernode_test.py
16 issues
Line: 5
Column: 1
import unittest
from certbot_apache._internal import interfaces
from certbot_apache._internal import parsernode_util as util
class DummyParserNode(interfaces.ParserNode):
""" A dummy class implementing ParserNode interface """
Reported by Pylint.
Line: 6
Column: 1
import unittest
from certbot_apache._internal import interfaces
from certbot_apache._internal import parsernode_util as util
class DummyParserNode(interfaces.ParserNode):
""" A dummy class implementing ParserNode interface """
Reported by Pylint.
Line: 25
Column: 9
def save(self, msg): # pragma: no cover
"""Save"""
pass
def find_ancestors(self, name): # pragma: no cover
""" Find ancestors """
return []
Reported by Pylint.
Line: 27
Column: 30
"""Save"""
pass
def find_ancestors(self, name): # pragma: no cover
""" Find ancestors """
return []
class DummyCommentNode(DummyParserNode):
Reported by Pylint.
Line: 61
Column: 9
def set_parameters(self, parameters): # pragma: no cover
"""Set parameters"""
pass
class DummyBlockNode(DummyDirectiveNode):
""" A dummy class implementing BlockNode interface """
Reported by Pylint.
Line: 69
Column: 9
def add_child_block(self, name, parameters=None, position=None): # pragma: no cover
"""Add child block"""
pass
def add_child_directive(self, name, parameters=None, position=None): # pragma: no cover
"""Add child directive"""
pass
Reported by Pylint.
Line: 73
Column: 9
def add_child_directive(self, name, parameters=None, position=None): # pragma: no cover
"""Add child directive"""
pass
def add_child_comment(self, comment="", position=None): # pragma: no cover
"""Add child comment"""
pass
Reported by Pylint.
Line: 77
Column: 9
def add_child_comment(self, comment="", position=None): # pragma: no cover
"""Add child comment"""
pass
def find_blocks(self, name, exclude=True): # pragma: no cover
"""Find blocks"""
pass
Reported by Pylint.
Line: 81
Column: 9
def find_blocks(self, name, exclude=True): # pragma: no cover
"""Find blocks"""
pass
def find_directives(self, name, exclude=True): # pragma: no cover
"""Find directives"""
pass
Reported by Pylint.
Line: 85
Column: 9
def find_directives(self, name, exclude=True): # pragma: no cover
"""Find directives"""
pass
def find_comments(self, comment, exact=False): # pragma: no cover
"""Find comments"""
pass
Reported by Pylint.
certbot-nginx/tests/test_util.py
16 issues
Line: 6
Column: 1
import shutil
import tempfile
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
import pkg_resources
Reported by Pylint.
Line: 13
Column: 1
from unittest import mock # type: ignore
import pkg_resources
from certbot import util
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_nginx._internal import configurator
from certbot_nginx._internal import nginxparser
Reported by Pylint.
Line: 14
Column: 1
import pkg_resources
from certbot import util
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_nginx._internal import configurator
from certbot_nginx._internal import nginxparser
Reported by Pylint.
Line: 15
Column: 1
from certbot import util
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_nginx._internal import configurator
from certbot_nginx._internal import nginxparser
Reported by Pylint.
Line: 16
Column: 1
from certbot import util
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_nginx._internal import configurator
from certbot_nginx._internal import nginxparser
class NginxTest(test_util.ConfigTestCase):
Reported by Pylint.
Line: 17
Column: 1
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_nginx._internal import configurator
from certbot_nginx._internal import nginxparser
class NginxTest(test_util.ConfigTestCase):
Reported by Pylint.
Line: 18
Column: 1
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot_nginx._internal import configurator
from certbot_nginx._internal import nginxparser
class NginxTest(test_util.ConfigTestCase):
def setUp(self):
Reported by Pylint.
Line: 26
Column: 30
def setUp(self):
super().setUp()
self.configuration = self.config
self.config = None
self.temp_dir, self.config_dir, self.work_dir = common.dir_setup(
"etc_nginx", __name__)
self.logs_dir = tempfile.mkdtemp('logs')
Reported by Pylint.
Line: 21
Column: 1
from certbot_nginx._internal import nginxparser
class NginxTest(test_util.ConfigTestCase):
def setUp(self):
super().setUp()
self.configuration = self.config
Reported by Pylint.
Line: 21
Column: 1
from certbot_nginx._internal import nginxparser
class NginxTest(test_util.ConfigTestCase):
def setUp(self):
super().setUp()
self.configuration = self.config
Reported by Pylint.
certbot-dns-gehirn/tests/dns_gehirn_test.py
16 issues
Line: 11
Column: 1
from unittest import mock # type: ignore
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
Reported by Pylint.
Line: 12
Column: 1
from requests.exceptions import HTTPError
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_TOKEN = '00000000-0000-0000-0000-000000000000'
Reported by Pylint.
Line: 13
Column: 1
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_TOKEN = '00000000-0000-0000-0000-000000000000'
API_SECRET = 'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw'
Reported by Pylint.
Line: 14
Column: 1
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_TOKEN = '00000000-0000-0000-0000-000000000000'
API_SECRET = 'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw'
Reported by Pylint.
Line: 15
Column: 1
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_TOKEN = '00000000-0000-0000-0000-000000000000'
API_SECRET = 'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw'
class AuthenticatorTest(test_util.TempDirTestCase,
Reported by Pylint.
Line: 26
Column: 9
def setUp(self):
super().setUp()
from certbot_dns_gehirn._internal.dns_gehirn import Authenticator
path = os.path.join(self.tempdir, 'file.ini')
dns_test_common.write(
{"gehirn_api_token": API_TOKEN, "gehirn_api_secret": API_SECRET},
path
Reported by Pylint.
Line: 49
Column: 9
LOGIN_ERROR = HTTPError('401 Client Error: Unauthorized for url: {0}.'.format(DOMAIN))
def setUp(self):
from certbot_dns_gehirn._internal.dns_gehirn import _GehirnLexiconClient
self.client = _GehirnLexiconClient(API_TOKEN, API_SECRET, 0)
self.provider_mock = mock.MagicMock()
self.client.provider = self.provider_mock
Reported by Pylint.
Line: 17
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util
API_TOKEN = '00000000-0000-0000-0000-000000000000'
API_SECRET = 'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw'
class AuthenticatorTest(test_util.TempDirTestCase,
dns_test_common_lexicon.BaseLexiconAuthenticatorTest):
Reported by Bandit.
Line: 18
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html
from certbot.tests import util as test_util
API_TOKEN = '00000000-0000-0000-0000-000000000000'
API_SECRET = 'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw'
class AuthenticatorTest(test_util.TempDirTestCase,
dns_test_common_lexicon.BaseLexiconAuthenticatorTest):
def setUp(self):
Reported by Bandit.
Line: 20
Column: 1
API_TOKEN = '00000000-0000-0000-0000-000000000000'
API_SECRET = 'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw'
class AuthenticatorTest(test_util.TempDirTestCase,
dns_test_common_lexicon.BaseLexiconAuthenticatorTest):
def setUp(self):
super().setUp()
Reported by Pylint.
certbot/docs/conf.py
16 issues
Line: 20
Column: 1
import re
import sys
import sphinx
here = os.path.abspath(os.path.dirname(__file__))
# read version number (and other metadata) from package init
init_fn = os.path.join(here, '..', 'certbot', '__init__.py')
Reported by Pylint.
Line: 140
Column: 5
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
# Theme options are theme-specific and customize the look and feel of a theme
Reported by Pylint.
Line: 1
Column: 1
# -*- coding: utf-8 -*-
#
# Certbot documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 23 20:35:21 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
Reported by Pylint.
Line: 37
Column: 1
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '1.2'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
Reported by Pylint.
Line: 53
Column: 1
if sphinx.version_info >= (1, 6):
extensions.append('sphinx.ext.imgconverter')
autodoc_member_order = 'bysource'
autodoc_default_flags = ['show-inheritance']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Reported by Pylint.
Line: 60
Column: 1
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
Reported by Pylint.
Line: 66
Column: 1
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Certbot'
# this is now overridden by the footer.html template
#copyright = u'2014-2018 - The Certbot software and documentation are licensed under the Apache 2.0 license as described at https://eff.org/cb-license.'
Reported by Pylint.
Line: 69
Column: 1
master_doc = 'index'
# General information about the project.
project = u'Certbot'
# this is now overridden by the footer.html template
#copyright = u'2014-2018 - The Certbot software and documentation are licensed under the Apache 2.0 license as described at https://eff.org/cb-license.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Reported by Pylint.
Line: 71
Column: 1
# General information about the project.
project = u'Certbot'
# this is now overridden by the footer.html template
#copyright = u'2014-2018 - The Certbot software and documentation are licensed under the Apache 2.0 license as described at https://eff.org/cb-license.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
Reported by Pylint.
Line: 78
Column: 1
# built documents.
#
# The short X.Y version.
version = '.'.join(meta['version'].split('.')[:2])
# The full version, including alpha/beta/rc tags.
release = meta['version']
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Reported by Pylint.
certbot-nginx/tests/http_01_test.py
16 issues
Line: 4
Column: 1
"""Tests for certbot_nginx._internal.http_01"""
import unittest
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
Reported by Pylint.
Line: 10
Column: 1
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from acme import challenges
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util as test_util
from certbot_nginx._internal.obj import Addr
import test_util as util
Reported by Pylint.
Line: 11
Column: 1
from unittest import mock # type: ignore
from acme import challenges
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util as test_util
from certbot_nginx._internal.obj import Addr
import test_util as util
Reported by Pylint.
Line: 12
Column: 1
from acme import challenges
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util as test_util
from certbot_nginx._internal.obj import Addr
import test_util as util
AUTH_KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
Reported by Pylint.
Line: 13
Column: 1
from acme import challenges
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util as test_util
from certbot_nginx._internal.obj import Addr
import test_util as util
AUTH_KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
Reported by Pylint.
Line: 14
Column: 1
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util as test_util
from certbot_nginx._internal.obj import Addr
import test_util as util
AUTH_KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
Reported by Pylint.
Line: 59
Column: 9
config = self.get_nginx_configurator(
self.config_path, self.config_dir, self.work_dir, self.logs_dir)
from certbot_nginx._internal import http_01
self.http01 = http_01.NginxHttp01(config)
def test_perform0(self):
responses = self.http01.perform()
self.assertEqual([], responses)
Reported by Pylint.
Line: 59
Column: 9
config = self.get_nginx_configurator(
self.config_path, self.config_dir, self.work_dir, self.logs_dir)
from certbot_nginx._internal import http_01
self.http01 = http_01.NginxHttp01(config)
def test_perform0(self):
responses = self.http01.perform()
self.assertEqual([], responses)
Reported by Pylint.
Line: 62
Column: 5
from certbot_nginx._internal import http_01
self.http01 = http_01.NginxHttp01(config)
def test_perform0(self):
responses = self.http01.perform()
self.assertEqual([], responses)
@mock.patch("certbot_nginx._internal.configurator.NginxConfigurator.save")
def test_perform1(self, mock_save):
Reported by Pylint.
Line: 67
Column: 5
self.assertEqual([], responses)
@mock.patch("certbot_nginx._internal.configurator.NginxConfigurator.save")
def test_perform1(self, mock_save):
self.http01.add_chall(self.achalls[0])
response = self.achalls[0].response(self.account_key)
responses = self.http01.perform()
Reported by Pylint.