The following issues were found

certbot-apache/tests/http_01_test.py
28 issues
Unable to import 'acme'
Error

Line: 11 Column: 1

              except ImportError: # pragma: no cover
    from unittest import mock # type: ignore

from acme import challenges
from certbot import achallenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 12 Column: 1

                  from unittest import mock # type: ignore

from acme import challenges
from certbot import achallenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache._internal.parser import get_aug_path

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 13 Column: 1

              
from acme import challenges
from certbot import achallenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache._internal.parser import get_aug_path
import util

            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 14 Column: 1

              from acme import challenges
from certbot import achallenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache._internal.parser import get_aug_path
import util


            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 15 Column: 1

              from certbot import achallenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache._internal.parser import get_aug_path
import util

NUM_ACHALLS = 3

            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

Line: 16 Column: 1

              from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache._internal.parser import get_aug_path
import util

NUM_ACHALLS = 3


            

Reported by Pylint.

Unable to import 'certbot_apache._internal.parser'
Error

Line: 17 Column: 1

              from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_util
from certbot_apache._internal.parser import get_aug_path
import util

NUM_ACHALLS = 3



            

Reported by Pylint.

Unable to import 'certbot_apache._internal.http_01'
Error

Line: 50 Column: 9

                          self.config.parser.modules["mod_{0}.c".format(mod)] = None
            self.config.parser.modules[mod + "_module"] = None

        from certbot_apache._internal.http_01 import ApacheHttp01
        self.http = ApacheHttp01(self.config)

    def test_empty_perform(self):
        self.assertFalse(self.http.perform())


            

Reported by Pylint.

Import outside toplevel (certbot_apache._internal.http_01.ApacheHttp01)
Error

Line: 50 Column: 9

                          self.config.parser.modules["mod_{0}.c".format(mod)] = None
            self.config.parser.modules[mod + "_module"] = None

        from certbot_apache._internal.http_01 import ApacheHttp01
        self.http = ApacheHttp01(self.config)

    def test_empty_perform(self):
        self.assertFalse(self.http.perform())


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 53 Column: 5

                      from certbot_apache._internal.http_01 import ApacheHttp01
        self.http = ApacheHttp01(self.config)

    def test_empty_perform(self):
        self.assertFalse(self.http.perform())

    @mock.patch("certbot_apache._internal.configurator.ApacheConfigurator.enable_mod")
    def test_enable_modules_apache_2_2(self, mock_enmod):
        self.config.version = (2, 2)

            

Reported by Pylint.

certbot/tests/ocsp_test.py
28 issues
Unable to import 'pytz'
Error

Line: 13 Column: 1

              from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
import pytz

from certbot import errors
from certbot.tests import util as test_util

try:

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 15 Column: 1

              from cryptography.hazmat.primitives import hashes
import pytz

from certbot import errors
from certbot.tests import util as test_util

try:
    import mock
except ImportError: # pragma: no cover

            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

Line: 16 Column: 1

              import pytz

from certbot import errors
from certbot.tests import util as test_util

try:
    import mock
except ImportError: # pragma: no cover
    from unittest import mock

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 44 Column: 9

                  """

    def setUp(self):
        from certbot import ocsp
        with mock.patch('certbot.ocsp.subprocess.run') as mock_run:
            with mock.patch('certbot.util.exe_exists') as mock_exists:
                mock_run.stderr = out
                mock_exists.return_value = True
                self.checker = ocsp.RevocationChecker(enforce_openssl_binary_usage=True)

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 61 Column: 9

                      mock_run.return_value.stderr = out
        mock_exists.return_value = True

        from certbot import ocsp
        checker = ocsp.RevocationChecker(enforce_openssl_binary_usage=True)
        self.assertEqual(mock_run.call_count, 1)
        self.assertEqual(checker.host_args("x"), ["Host=x"])

        mock_run.return_value.stderr = out.partition("\n")[2]

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 113 Column: 9

                  def test_determine_ocsp_server(self):
        cert_path = test_util.vector_path('ocsp_certificate.pem')

        from certbot import ocsp
        result = ocsp._determine_ocsp_server(cert_path)
        self.assertEqual(('http://ocsp.test4.buypass.com', 'ocsp.test4.buypass.com'), result)

    @mock.patch('certbot.ocsp.logger')
    @mock.patch('certbot.util.run_script')

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 122 Column: 9

                  def test_translate_ocsp(self, mock_run, mock_log):
        # pylint: disable=protected-access
        mock_run.return_value = openssl_confused
        from certbot import ocsp
        self.assertIs(ocsp._translate_ocsp_query(*openssl_happy), False)
        self.assertIs(ocsp._translate_ocsp_query(*openssl_confused), False)
        self.assertEqual(mock_log.debug.call_count, 1)
        self.assertEqual(mock_log.warning.call_count, 0)
        mock_log.debug.call_count = 0

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 150 Column: 9

                  """

    def setUp(self):
        from certbot import ocsp
        self.checker = ocsp.RevocationChecker()
        self.cert_path = test_util.vector_path('ocsp_certificate.pem')
        self.chain_path = test_util.vector_path('ocsp_issuer_certificate.pem')
        self.cert_obj = mock.MagicMock()
        self.cert_obj.cert_path = self.cert_path

            

Reported by Pylint.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 331
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

                  responder = x509.load_pem_x509_certificate(
        test_util.load_vector('ocsp_responder_certificate.pem'), default_backend())
    builder = ocsp_lib.OCSPRequestBuilder()
    builder = builder.add_certificate(cert, issuer, hashes.SHA1())
    request = builder.build()

    return mock.Mock(
        response_status=response_status,
        certificate_status=certificate_status,

            

Reported by Bandit.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 342
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

                      issuer_name_hash=request.issuer_name_hash,
        responder_name=responder.subject,
        certificates=[responder],
        hash_algorithm=hashes.SHA1(),
        next_update=datetime.now() + timedelta(days=1),
        this_update=datetime.now() - timedelta(days=1),
        signature_algorithm_oid=x509.oid.SignatureAlgorithmOID.RSA_WITH_SHA1,
    )


            

Reported by Bandit.

certbot-dns-route53/tests/dns_route53_test.py
28 issues
Unable to import 'botocore.exceptions'
Error

Line: 5 Column: 1

              
import unittest

from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
try:
    import mock
except ImportError: # pragma: no cover
    from unittest import mock # type: ignore

            

Reported by Pylint.

Unable to import 'botocore.exceptions'
Error

Line: 6 Column: 1

              import unittest

from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
try:
    import mock
except ImportError: # pragma: no cover
    from unittest import mock # type: ignore


            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 12 Column: 1

              except ImportError: # pragma: no cover
    from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN



            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 13 Column: 1

                  from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN


class AuthenticatorTest(unittest.TestCase, dns_test_common.BaseAuthenticatorTest):

            

Reported by Pylint.

Unable to import 'certbot.plugins'
Error

Line: 14 Column: 1

              
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN


class AuthenticatorTest(unittest.TestCase, dns_test_common.BaseAuthenticatorTest):
    # pylint: disable=protected-access

            

Reported by Pylint.

Unable to import 'certbot.plugins.dns_test_common'
Error

Line: 15 Column: 1

              from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN


class AuthenticatorTest(unittest.TestCase, dns_test_common.BaseAuthenticatorTest):
    # pylint: disable=protected-access


            

Reported by Pylint.

Unable to import 'certbot_dns_route53._internal.dns_route53'
Error

Line: 22 Column: 9

                  # pylint: disable=protected-access

    def setUp(self):
        from certbot_dns_route53._internal.dns_route53 import Authenticator

        super().setUp()

        self.config = mock.MagicMock()


            

Reported by Pylint.

Unable to import 'certbot_dns_route53._internal.dns_route53'
Error

Line: 128 Column: 9

                                          }

    def setUp(self):
        from certbot_dns_route53._internal.dns_route53 import Authenticator

        self.config = mock.MagicMock()

        # Set up dummy credentials for testing
        os.environ["AWS_ACCESS_KEY_ID"] = "dummy_access_key"

            

Reported by Pylint.

Missing class docstring
Error

Line: 18 Column: 1

              from certbot.plugins.dns_test_common import DOMAIN


class AuthenticatorTest(unittest.TestCase, dns_test_common.BaseAuthenticatorTest):
    # pylint: disable=protected-access

    def setUp(self):
        from certbot_dns_route53._internal.dns_route53 import Authenticator


            

Reported by Pylint.

Import outside toplevel (certbot_dns_route53._internal.dns_route53.Authenticator)
Error

Line: 22 Column: 9

                  # pylint: disable=protected-access

    def setUp(self):
        from certbot_dns_route53._internal.dns_route53 import Authenticator

        super().setUp()

        self.config = mock.MagicMock()


            

Reported by Pylint.

certbot/certbot/crypto_util.py
26 issues
Unable to import 'pyrfc3339'
Error

Line: 28 Column: 1

              from cryptography.hazmat.primitives.serialization import PrivateFormat
from OpenSSL import crypto
from OpenSSL import SSL
import pyrfc3339
import zope.component

from acme import crypto_util as acme_crypto_util
from certbot import errors
from certbot import interfaces

            

Reported by Pylint.

No name 'component' in module 'zope'
Error

Line: 29 Column: 1

              from OpenSSL import crypto
from OpenSSL import SSL
import pyrfc3339
import zope.component

from acme import crypto_util as acme_crypto_util
from certbot import errors
from certbot import interfaces
from certbot import util

            

Reported by Pylint.

Unable to import 'zope.component'
Error

Line: 29 Column: 1

              from OpenSSL import crypto
from OpenSSL import SSL
import pyrfc3339
import zope.component

from acme import crypto_util as acme_crypto_util
from certbot import errors
from certbot import interfaces
from certbot import util

            

Reported by Pylint.

Unable to import 'acme'
Error

Line: 31 Column: 1

              import pyrfc3339
import zope.component

from acme import crypto_util as acme_crypto_util
from certbot import errors
from certbot import interfaces
from certbot import util
from certbot.compat import os


            

Reported by Pylint.

Module 'zope' has no 'component' member
Error

Line: 117 Column: 14

                  warnings.warn("certbot.crypto_util.init_save_key is deprecated, please use "
                  "certbot.crypto_util.generate_key instead.", DeprecationWarning)

    config = zope.component.getUtility(interfaces.IConfig)

    return generate_key(key_size, key_dir, key_type=key_type, elliptic_curve=elliptic_curve,
                        keyname=keyname, strict_permissions=config.strict_permissions)



            

Reported by Pylint.

Module 'zope' has no 'component' member
Error

Line: 174 Column: 14

                  warnings.warn("certbot.crypto_util.init_save_csr is deprecated, please use "
                  "certbot.crypto_util.generate_csr instead.", DeprecationWarning)

    config = zope.component.getUtility(interfaces.IConfig)

    return generate_csr(privkey, names, path, must_staple=config.must_staple,
                        strict_permissions=config.strict_permissions)



            

Reported by Pylint.

TODO: Remove this call once zope dependencies are removed from Certbot.
Error

Line: 89 Column: 3

                  return util.Key(key_path, key_pem)


# TODO: Remove this call once zope dependencies are removed from Certbot.
def init_save_key(key_size, key_dir, key_type="rsa", elliptic_curve="secp256r1",
                  keyname="key-certbot.pem"):
    """Initializes and saves a privkey.

    Inits key and saves it in PEM format on the filesystem.

            

Reported by Pylint.

TODO: Remove this call once zope dependencies are removed from Certbot.
Error

Line: 153 Column: 3

                  return util.CSR(csr_filename, csr_pem, "pem")


# TODO: Remove this call once zope dependencies are removed from Certbot.
def init_save_csr(privkey, names, path):
    """Initialize a CSR with the given private key.

    .. deprecated:: 1.16.0
       Use :func:`generate_csr` instead.

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 246 Column: 13

                      try:
            csr = load(PEM, data)
        except crypto.Error:
            raise errors.Error("Failed to parse CSR file: {0}".format(csrfile))

    domains = _get_names_from_loaded_cert_or_req(csr)
    # Internally we always use PEM, so re-encode as PEM before returning.
    data_pem = crypto.dump_certificate_request(PEM, csr)
    return PEM, util.CSR(file=csrfile, data=data_pem, form="pem"), domains

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 282 Column: 13

                          else:
                raise errors.Error("Unsupported elliptic curve: {}".format(elliptic_curve))
        except TypeError:
            raise errors.Error("Unsupported elliptic curve: {}".format(elliptic_curve))
        except UnsupportedAlgorithm as e:
            raise e from errors.Error(str(e))
        # This type ignore directive is required due to an outdated version of types-cryptography.
        # It can be removed once package types-pyOpenSSL depends on cryptography instead of
        # types-cryptography and so types-cryptography is not installed anymore.

            

Reported by Pylint.

certbot/tests/plugins/storage_test.py
26 issues
Unable to import 'certbot'
Error

Line: 8 Column: 1

              from typing import Optional
import unittest

from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import util as test_util

try:

            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 9 Column: 1

              import unittest

from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import util as test_util

try:
    import mock

            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 10 Column: 1

              
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import util as test_util

try:
    import mock
except ImportError: # pragma: no cover

            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

Line: 11 Column: 1

              from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import util as test_util

try:
    import mock
except ImportError: # pragma: no cover
    from unittest import mock

            

Reported by Pylint.

Unused Iterable imported from typing
Error

Line: 3 Column: 1

              """Tests for certbot.plugins.storage.PluginStorage"""
import json
from typing import Iterable
from typing import List
from typing import Optional
import unittest

from certbot import errors
from certbot.compat import filesystem

            

Reported by Pylint.

Unused List imported from typing
Error

Line: 4 Column: 1

              """Tests for certbot.plugins.storage.PluginStorage"""
import json
from typing import Iterable
from typing import List
from typing import Optional
import unittest

from certbot import errors
from certbot.compat import filesystem

            

Reported by Pylint.

Unused Optional imported from typing
Error

Line: 5 Column: 1

              import json
from typing import Iterable
from typing import List
from typing import Optional
import unittest

from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os

            

Reported by Pylint.

Access to a protected member _storagepath of a client class
Error

Line: 37 Column: 9

                      # When unable to read file that exists
        mock_open = mock.mock_open()
        mock_open.side_effect = IOError
        self.plugin.storage._storagepath = os.path.join(self.config.config_dir,
                                                       ".pluginstorage.json")
        with mock.patch("builtins.open", mock_open):
            with mock.patch('certbot.compat.os.path.isfile', return_value=True):
                with mock.patch("certbot.reverter.util"):
                    self.assertRaises(errors.PluginStorageError,

            

Reported by Pylint.

Access to a protected member _storagepath of a client class
Error

Line: 73 Column: 13

                      with mock.patch("certbot.plugins.storage.logger.error") as mock_log:
            # Set data as something that can't be serialized
            self.plugin.storage._initialized = True  # pylint: disable=protected-access
            self.plugin.storage._storagepath = "/tmp/whatever"
            self.plugin.storage._data = self.plugin_cls  # pylint: disable=protected-access
            self.assertRaises(errors.PluginStorageError,
                              self.plugin.storage.save)
            self.assertIn("Could not serialize", mock_log.call_args[0][0])


            

Reported by Pylint.

Probable insecure usage of temp file/directory.
Security

Line: 73
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b108_hardcoded_tmp_directory.html

                      with mock.patch("certbot.plugins.storage.logger.error") as mock_log:
            # Set data as something that can't be serialized
            self.plugin.storage._initialized = True  # pylint: disable=protected-access
            self.plugin.storage._storagepath = "/tmp/whatever"
            self.plugin.storage._data = self.plugin_cls  # pylint: disable=protected-access
            self.assertRaises(errors.PluginStorageError,
                              self.plugin.storage.save)
            self.assertIn("Could not serialize", mock_log.call_args[0][0])


            

Reported by Bandit.

certbot-apache/certbot_apache/_internal/assertions.py
25 issues
Possible hardcoded password: 'CERTBOT_PASS_ASSERT'
Security

Line: 6
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

              
from certbot_apache._internal import interfaces

PASS = "CERTBOT_PASS_ASSERT"


def assertEqual(first, second):
    """ Equality assertion """


            

Reported by Bandit.

Function name "assertEqual" doesn't conform to snake_case naming style
Error

Line: 9 Column: 1

              PASS = "CERTBOT_PASS_ASSERT"


def assertEqual(first, second):
    """ Equality assertion """

    if isinstance(first, interfaces.CommentNode):
        assertEqualComment(first, second)
    elif isinstance(first, interfaces.DirectiveNode):

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 20
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  # Do an extra interface implementation assertion, as the contents were
    # already checked for BlockNode in the assertEqualDirective
    if isinstance(first, interfaces.BlockNode):
        assert isinstance(second, interfaces.BlockNode)

    # Skip tests if filepath includes the pass value. This is done
    # because filepath is variable of the base ParserNode interface, and
    # unless the implementation is actually done, we cannot assume getting
    # correct results from boolean assertion for dirty

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 27
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  # unless the implementation is actually done, we cannot assume getting
    # correct results from boolean assertion for dirty
    if not isPass(first.filepath) and not isPass(second.filepath):
        assert first.dirty == second.dirty
        # We might want to disable this later if testing with two separate
        # (but identical) directory structures.
        assert first.filepath == second.filepath

def assertEqualComment(first, second): # pragma: no cover

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 30
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      assert first.dirty == second.dirty
        # We might want to disable this later if testing with two separate
        # (but identical) directory structures.
        assert first.filepath == second.filepath

def assertEqualComment(first, second): # pragma: no cover
    """ Equality assertion for CommentNode """

    assert isinstance(first, interfaces.CommentNode)

            

Reported by Bandit.

Function name "assertEqualComment" doesn't conform to snake_case naming style
Error

Line: 32 Column: 1

                      # (but identical) directory structures.
        assert first.filepath == second.filepath

def assertEqualComment(first, second): # pragma: no cover
    """ Equality assertion for CommentNode """

    assert isinstance(first, interfaces.CommentNode)
    assert isinstance(second, interfaces.CommentNode)


            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 35
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def assertEqualComment(first, second): # pragma: no cover
    """ Equality assertion for CommentNode """

    assert isinstance(first, interfaces.CommentNode)
    assert isinstance(second, interfaces.CommentNode)

    if not isPass(first.comment) and not isPass(second.comment):  # type: ignore
        assert first.comment == second.comment  # type: ignore


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 36
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  """ Equality assertion for CommentNode """

    assert isinstance(first, interfaces.CommentNode)
    assert isinstance(second, interfaces.CommentNode)

    if not isPass(first.comment) and not isPass(second.comment):  # type: ignore
        assert first.comment == second.comment  # type: ignore

def _assertEqualDirectiveComponents(first, second): # pragma: no cover

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 39
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  assert isinstance(second, interfaces.CommentNode)

    if not isPass(first.comment) and not isPass(second.comment):  # type: ignore
        assert first.comment == second.comment  # type: ignore

def _assertEqualDirectiveComponents(first, second): # pragma: no cover
    """ Handles assertion for instance variables for DirectiveNode and BlockNode"""

    # Enabled value cannot be asserted, because Augeas implementation

            

Reported by Bandit.

Function name "_assertEqualDirectiveComponents" doesn't conform to snake_case naming style
Error

Line: 41 Column: 1

                  if not isPass(first.comment) and not isPass(second.comment):  # type: ignore
        assert first.comment == second.comment  # type: ignore

def _assertEqualDirectiveComponents(first, second): # pragma: no cover
    """ Handles assertion for instance variables for DirectiveNode and BlockNode"""

    # Enabled value cannot be asserted, because Augeas implementation
    # is unable to figure that out.
    # assert first.enabled == second.enabled

            

Reported by Pylint.

certbot-dns-linode/tests/dns_linode_test.py
25 issues
Unable to import 'certbot'
Error

Line: 10 Column: 1

              except ImportError: # pragma: no cover
    from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator

            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 11 Column: 1

                  from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator


            

Reported by Pylint.

Unable to import 'certbot.plugins'
Error

Line: 12 Column: 1

              
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator

TOKEN = 'a-token'

            

Reported by Pylint.

Unable to import 'certbot.plugins'
Error

Line: 13 Column: 1

              from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator

TOKEN = 'a-token'
TOKEN_V3 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ64'

            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

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.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator

TOKEN = 'a-token'
TOKEN_V3 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ64'
TOKEN_V4 = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'

            

Reported by Pylint.

Unable to import 'certbot_dns_linode._internal.dns_linode'
Error

Line: 15 Column: 1

              from certbot.plugins import dns_test_common
from certbot.plugins import dns_test_common_lexicon
from certbot.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator

TOKEN = 'a-token'
TOKEN_V3 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ64'
TOKEN_V4 = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'


            

Reported by Pylint.

Unable to import 'certbot_dns_linode._internal.dns_linode'
Error

Line: 127 Column: 9

                  DOMAIN_NOT_FOUND = Exception('Domain not found')

    def setUp(self):
        from certbot_dns_linode._internal.dns_linode import _LinodeLexiconClient

        self.client = _LinodeLexiconClient(TOKEN, 3)

        self.provider_mock = mock.MagicMock()
        self.client.provider = self.provider_mock

            

Reported by Pylint.

Unable to import 'certbot_dns_linode._internal.dns_linode'
Error

Line: 139 Column: 9

                  DOMAIN_NOT_FOUND = Exception('Domain not found')

    def setUp(self):
        from certbot_dns_linode._internal.dns_linode import _LinodeLexiconClient

        self.client = _LinodeLexiconClient(TOKEN, 4)

        self.provider_mock = mock.MagicMock()
        self.client.provider = self.provider_mock

            

Reported by Pylint.

Possible hardcoded password: 'a-token'
Security

Line: 17
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

              from certbot.tests import util as test_util
from certbot_dns_linode._internal.dns_linode import Authenticator

TOKEN = 'a-token'
TOKEN_V3 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ64'
TOKEN_V4 = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'

class AuthenticatorTest(test_util.TempDirTestCase,
                        dns_test_common_lexicon.BaseLexiconAuthenticatorTest):

            

Reported by Bandit.

Possible hardcoded password: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ64'
Security

Line: 18
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

              from certbot_dns_linode._internal.dns_linode import Authenticator

TOKEN = 'a-token'
TOKEN_V3 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ64'
TOKEN_V4 = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'

class AuthenticatorTest(test_util.TempDirTestCase,
                        dns_test_common_lexicon.BaseLexiconAuthenticatorTest):


            

Reported by Bandit.

certbot-dns-digitalocean/tests/dns_digitalocean_test.py
25 issues
Unable to import 'digitalocean'
Error

Line: 5 Column: 1

              
import unittest

import digitalocean
try:
    import mock
except ImportError: # pragma: no cover
    from unittest import mock # type: ignore


            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 11 Column: 1

              except ImportError: # pragma: no cover
    from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util


            

Reported by Pylint.

Unable to import 'certbot.compat'
Error

Line: 12 Column: 1

                  from unittest import mock # type: ignore

from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util

API_ERROR = digitalocean.DataReadError()

            

Reported by Pylint.

Unable to import 'certbot.plugins'
Error

Line: 13 Column: 1

              
from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util

API_ERROR = digitalocean.DataReadError()
TOKEN = 'a-token'

            

Reported by Pylint.

Unable to import 'certbot.plugins.dns_test_common'
Error

Line: 14 Column: 1

              from certbot import errors
from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util

API_ERROR = digitalocean.DataReadError()
TOKEN = 'a-token'


            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

Line: 15 Column: 1

              from certbot.compat import os
from certbot.plugins import dns_test_common
from certbot.plugins.dns_test_common import DOMAIN
from certbot.tests import util as test_util

API_ERROR = digitalocean.DataReadError()
TOKEN = 'a-token'



            

Reported by Pylint.

Unable to import 'certbot_dns_digitalocean._internal.dns_digitalocean'
Error

Line: 24 Column: 9

              class AuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthenticatorTest):

    def setUp(self):
        from certbot_dns_digitalocean._internal.dns_digitalocean import Authenticator

        super().setUp()

        path = os.path.join(self.tempdir, 'file.ini')
        dns_test_common.write({"digitalocean_token": TOKEN}, path)

            

Reported by Pylint.

Unable to import 'certbot_dns_digitalocean._internal.dns_digitalocean'
Error

Line: 65 Column: 9

                  record_ttl = 60

    def setUp(self):
        from certbot_dns_digitalocean._internal.dns_digitalocean import _DigitalOceanClient

        self.digitalocean_client = _DigitalOceanClient(TOKEN)

        self.manager = mock.MagicMock()
        self.digitalocean_client.manager = self.manager

            

Reported by Pylint.

Possible hardcoded password: 'a-token'
Security

Line: 18
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b105_hardcoded_password_string.html

              from certbot.tests import util as test_util

API_ERROR = digitalocean.DataReadError()
TOKEN = 'a-token'


class AuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthenticatorTest):

    def setUp(self):

            

Reported by Bandit.

Missing class docstring
Error

Line: 21 Column: 1

              TOKEN = 'a-token'


class AuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthenticatorTest):

    def setUp(self):
        from certbot_dns_digitalocean._internal.dns_digitalocean import Authenticator

        super().setUp()

            

Reported by Pylint.

certbot-apache/tests/obj_test.py
24 issues
Unable to import 'certbot_apache._internal.obj'
Error

Line: 9 Column: 9

                  """Test the VirtualHost class."""

    def setUp(self):
        from certbot_apache._internal.obj import Addr
        from certbot_apache._internal.obj import VirtualHost

        self.addr1 = Addr.fromstring("127.0.0.1")
        self.addr2 = Addr.fromstring("127.0.0.1:443")
        self.addr_default = Addr.fromstring("_default_:443")

            

Reported by Pylint.

Unable to import 'certbot_apache._internal.obj'
Error

Line: 10 Column: 9

              
    def setUp(self):
        from certbot_apache._internal.obj import Addr
        from certbot_apache._internal.obj import VirtualHost

        self.addr1 = Addr.fromstring("127.0.0.1")
        self.addr2 = Addr.fromstring("127.0.0.1:443")
        self.addr_default = Addr.fromstring("_default_:443")


            

Reported by Pylint.

Unable to import 'certbot_apache._internal.obj'
Error

Line: 40 Column: 9

                      self.assertEqual(self.vhost1, self.vhost1b)

    def test_conflicts(self):
        from certbot_apache._internal.obj import Addr
        from certbot_apache._internal.obj import VirtualHost

        complex_vh = VirtualHost(
            "fp", "vhp",
            {Addr.fromstring("*:443"), Addr.fromstring("1.2.3.4:443")},

            

Reported by Pylint.

Unable to import 'certbot_apache._internal.obj'
Error

Line: 41 Column: 9

              
    def test_conflicts(self):
        from certbot_apache._internal.obj import Addr
        from certbot_apache._internal.obj import VirtualHost

        complex_vh = VirtualHost(
            "fp", "vhp",
            {Addr.fromstring("*:443"), Addr.fromstring("1.2.3.4:443")},
            False, False)

            

Reported by Pylint.

Unable to import 'certbot_apache._internal.obj'
Error

Line: 58 Column: 9

                                                              self.addr_default]))

    def test_same_server(self):
        from certbot_apache._internal.obj import VirtualHost
        no_name1 = VirtualHost(
            "fp", "vhp", {self.addr1}, False, False, None)
        no_name2 = VirtualHost(
            "fp", "vhp", {self.addr2}, False, False, None)
        no_name3 = VirtualHost(

            

Reported by Pylint.

Unable to import 'certbot_apache._internal.obj'
Error

Line: 81 Column: 9

              class AddrTest(unittest.TestCase):
    """Test obj.Addr."""
    def setUp(self):
        from certbot_apache._internal.obj import Addr
        self.addr = Addr.fromstring("*:443")

        self.addr1 = Addr.fromstring("127.0.0.1")
        self.addr2 = Addr.fromstring("127.0.0.1:*")


            

Reported by Pylint.

Unable to import 'certbot_apache._internal.obj'
Error

Line: 96 Column: 9

                      self.assertTrue(self.addr2.is_wildcard())

    def test_get_sni_addr(self):
        from certbot_apache._internal.obj import Addr
        self.assertEqual(
            self.addr.get_sni_addr("443"), Addr.fromstring("*:443"))
        self.assertEqual(
            self.addr.get_sni_addr("225"), Addr.fromstring("*:225"))
        self.assertEqual(

            

Reported by Pylint.

Import outside toplevel (certbot_apache._internal.obj.Addr)
Error

Line: 9 Column: 9

                  """Test the VirtualHost class."""

    def setUp(self):
        from certbot_apache._internal.obj import Addr
        from certbot_apache._internal.obj import VirtualHost

        self.addr1 = Addr.fromstring("127.0.0.1")
        self.addr2 = Addr.fromstring("127.0.0.1:443")
        self.addr_default = Addr.fromstring("_default_:443")

            

Reported by Pylint.

Import outside toplevel (certbot_apache._internal.obj.VirtualHost)
Error

Line: 10 Column: 9

              
    def setUp(self):
        from certbot_apache._internal.obj import Addr
        from certbot_apache._internal.obj import VirtualHost

        self.addr1 = Addr.fromstring("127.0.0.1")
        self.addr2 = Addr.fromstring("127.0.0.1:443")
        self.addr_default = Addr.fromstring("_default_:443")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 5

                      self.vhost2 = VirtualHost(
            "fp", "vhp", {self.addr2}, False, False, "localhost")

    def test_repr(self):
        self.assertEqual(repr(self.addr2),
            "certbot_apache._internal.obj.Addr(('127.0.0.1', '443'))")

    def test_eq(self):
        self.assertEqual(self.vhost1b, self.vhost1)

            

Reported by Pylint.

certbot/tests/plugins/standalone_test.py
24 issues
Unable to import 'josepy'
Error

Line: 9 Column: 1

              from typing import Tuple
import unittest

import josepy as jose
import OpenSSL.crypto  # pylint: disable=unused-import

from acme import challenges
from acme import standalone as acme_standalone  # pylint: disable=unused-import
from certbot import achallenges

            

Reported by Pylint.

Unable to import 'acme'
Error

Line: 12 Column: 1

              import josepy as jose
import OpenSSL.crypto  # pylint: disable=unused-import

from acme import challenges
from acme import standalone as acme_standalone  # pylint: disable=unused-import
from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
from certbot.tests import util as test_util

            

Reported by Pylint.

Unable to import 'acme'
Error

Line: 13 Column: 1

              import OpenSSL.crypto  # pylint: disable=unused-import

from acme import challenges
from acme import standalone as acme_standalone  # pylint: disable=unused-import
from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
from certbot.tests import util as test_util


            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 14 Column: 1

              
from acme import challenges
from acme import standalone as acme_standalone  # pylint: disable=unused-import
from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
from certbot.tests import util as test_util

try:

            

Reported by Pylint.

Unable to import 'certbot'
Error

Line: 15 Column: 1

              from acme import challenges
from acme import standalone as acme_standalone  # pylint: disable=unused-import
from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
from certbot.tests import util as test_util

try:
    import mock

            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

Line: 16 Column: 1

              from acme import standalone as acme_standalone  # pylint: disable=unused-import
from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
from certbot.tests import util as test_util

try:
    import mock
except ImportError: # pragma: no cover

            

Reported by Pylint.

Unable to import 'certbot.tests'
Error

Line: 17 Column: 1

              from certbot import achallenges
from certbot import errors
from certbot.tests import acme_util
from certbot.tests import util as test_util

try:
    import mock
except ImportError: # pragma: no cover
    from unittest import mock

            

Reported by Pylint.

Unable to import 'certbot._internal.plugins.standalone'
Error

Line: 30 Column: 9

                  """Tests for certbot._internal.plugins.standalone.ServerManager."""

    def setUp(self):
        from certbot._internal.plugins.standalone import ServerManager
        self.certs: Dict[bytes, Tuple[OpenSSL.crypto.PKey, OpenSSL.crypto.X509]] = {}
        self.http_01_resources: Set[acme_standalone.HTTP01RequestHandler.HTTP01Resource] = {}
        self.mgr = ServerManager(self.certs, self.http_01_resources)

    def test_init(self):

            

Reported by Pylint.

Unable to import 'certbot._internal.plugins.standalone'
Error

Line: 88 Column: 9

                  """Tests for certbot._internal.plugins.standalone.Authenticator."""

    def setUp(self):
        from certbot._internal.plugins.standalone import Authenticator

        self.config = mock.MagicMock(http01_port=get_open_port())
        self.auth = Authenticator(self.config, name="standalone")
        self.auth.servers = mock.MagicMock()


            

Reported by Pylint.

Import outside toplevel (certbot._internal.plugins.standalone.ServerManager)
Error

Line: 30 Column: 9

                  """Tests for certbot._internal.plugins.standalone.ServerManager."""

    def setUp(self):
        from certbot._internal.plugins.standalone import ServerManager
        self.certs: Dict[bytes, Tuple[OpenSSL.crypto.PKey, OpenSSL.crypto.X509]] = {}
        self.http_01_resources: Set[acme_standalone.HTTP01RequestHandler.HTTP01Resource] = {}
        self.mgr = ServerManager(self.certs, self.http_01_resources)

    def test_init(self):

            

Reported by Pylint.