Ensure the correct dbm module is used for all envs

This commit is contained in:
Joona Hoikkala 2018-08-22 11:57:51 +03:00
parent ba9de53768
commit 35c0d79390
No known key found for this signature in database
GPG key ID: D5AA86BBF9B29A5C
3 changed files with 14 additions and 3 deletions

View file

@ -138,8 +138,8 @@ def certid_sha1_hex(cert_path):
"""
sha1_hex = binascii.hexlify(certid_sha1(cert_path))
if isinstance(sha1_hex, six.binary_type):
return sha1_hex.decode('utf-8')
return sha1_hex
return sha1_hex.decode('utf-8') # pragma: no cover
return sha1_hex # pragma: no cover
def certid_sha1(cert_path):

View file

@ -39,6 +39,12 @@ from certbot_apache import tls_sni_01
from collections import defaultdict
try:
import dbm.ndbm as dbm # pragma: no cover
except ImportError: # pragma: no cover
# dbm.ndbm only available on Python3
import dbm # pragma: no cover
logger = logging.getLogger(__name__)

View file

@ -1,5 +1,4 @@
"""Test for certbot_apache.configurator OCSP Prefetching functionality"""
import dbm
import os
import unittest
import mock
@ -8,6 +7,12 @@ import six # pylint: disable=unused-import
from certbot_apache.tests import util
try:
import dbm.ndbm as dbm # pragma: no cover
except ImportError: # pragma: no cover
# dbm.ndbm only available on Python3
import dbm # pragma: no cover
class OCSPPrefetchTest(util.ApacheTest):
"""Tests for OCSP Prefetch feature"""