Skip to content

Instantly share code, notes, and snippets.

@bmw
Created July 19, 2021 21:11
Show Gist options
  • Save bmw/bbfc65284e60ae577f6929d5382f6150 to your computer and use it in GitHub Desktop.
Save bmw/bbfc65284e60ae577f6929d5382f6150 to your computer and use it in GitHub Desktop.
diff --git a/certbot-apache/tests/debian_test.py b/certbot-apache/tests/debian_test.py
index b5a486ff1..35425223b 100644
--- a/certbot-apache/tests/debian_test.py
+++ b/certbot-apache/tests/debian_test.py
@@ -9,6 +9,7 @@ except ImportError: # pragma: no cover
from certbot import errors
from certbot.compat import os
+from certbot.tests import util as certbot_util
from certbot_apache._internal import apache_util
from certbot_apache._internal import obj
import util
@@ -68,17 +69,18 @@ class MultipleVhostsTestDebian(util.ApacheTest):
self.config.parser.modules["ssl_module"] = None
self.config.parser.modules["mod_ssl.c"] = None
self.assertFalse(ssl_vhost.enabled)
- self.config.deploy_cert(
- "encryption-example.demo", "example/cert.pem", "example/key.pem",
- "example/cert_chain.pem", "example/fullchain.pem")
- self.assertTrue(ssl_vhost.enabled)
- # Make sure that we don't error out if symlink already exists
- ssl_vhost.enabled = False
- self.assertFalse(ssl_vhost.enabled)
- self.config.deploy_cert(
- "encryption-example.demo", "example/cert.pem", "example/key.pem",
- "example/cert_chain.pem", "example/fullchain.pem")
- self.assertTrue(ssl_vhost.enabled)
+ with certbot_util.patch_display_util():
+ self.config.deploy_cert(
+ "encryption-example.demo", "example/cert.pem", "example/key.pem",
+ "example/cert_chain.pem", "example/fullchain.pem")
+ self.assertTrue(ssl_vhost.enabled)
+ # Make sure that we don't error out if symlink already exists
+ ssl_vhost.enabled = False
+ self.assertFalse(ssl_vhost.enabled)
+ self.config.deploy_cert(
+ "encryption-example.demo", "example/cert.pem", "example/key.pem",
+ "example/cert_chain.pem", "example/fullchain.pem")
+ self.assertTrue(ssl_vhost.enabled)
def test_enable_site_failure(self):
self.config.parser.root = "/tmp/nonexistent"
@@ -101,9 +103,10 @@ class MultipleVhostsTestDebian(util.ApacheTest):
# Get the default 443 vhost
self.config.assoc["random.demo"] = self.vh_truth[1]
- self.config.deploy_cert(
- "random.demo", "example/cert.pem", "example/key.pem",
- "example/cert_chain.pem", "example/fullchain.pem")
+ with certbot_util.patch_display_util():
+ self.config.deploy_cert(
+ "random.demo", "example/cert.pem", "example/key.pem",
+ "example/cert_chain.pem", "example/fullchain.pem")
self.config.save()
# Verify ssl_module was enabled.
diff --git a/certbot-apache/tests/util.py b/certbot-apache/tests/util.py
index ecd4ac4ec..b9e7d2ea0 100644
--- a/certbot-apache/tests/util.py
+++ b/certbot-apache/tests/util.py
@@ -15,7 +15,6 @@ 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._internal.display import obj as display_obj
from certbot_apache._internal import configurator
from certbot_apache._internal import entrypoint
from certbot_apache._internal import obj
@@ -70,8 +69,6 @@ class ParserTest(ApacheTest):
vhost_root="debian_apache_2_4/multiple_vhosts/apache2/sites-available"):
super().setUp(test_dir, config_root, vhost_root)
- display_obj.set_display(display_util.FileDisplay(sys.stdout, False))
-
from certbot_apache._internal.parser import ApacheParser
self.aug = augeas.Augeas(
flags=augeas.Augeas.NONE | augeas.Augeas.NO_MODL_AUTOLOAD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment