Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOsirisInferi <github@flut.demon.nl>2020-02-06 23:10:41 +0300
committerOsirisInferi <github@flut.demon.nl>2020-02-06 23:10:41 +0300
commit5035a510a2e4f3e1d44223e59036f74c0f7c58b1 (patch)
treed3ad91dfd8d7f5df5b4d015ecc233b0b1a8ae198
parent9b35dbf2be7193e189cc3b74596a4045c5feb399 (diff)
Add test for $hostname parsing
-rw-r--r--certbot-nginx/tests/configurator_test.py6
-rw-r--r--certbot-nginx/tests/testdata/etc_nginx/sites-enabled/example.net5
2 files changed, 9 insertions, 2 deletions
diff --git a/certbot-nginx/tests/configurator_test.py b/certbot-nginx/tests/configurator_test.py
index ef5593395..57097859a 100644
--- a/certbot-nginx/tests/configurator_test.py
+++ b/certbot-nginx/tests/configurator_test.py
@@ -76,15 +76,17 @@ class NginxConfiguratorTest(util.NginxTest):
else: # pragma: no cover
self.fail("Exception wasn't raised!")
+ @mock.patch("certbot_nginx._internal.configurator.socket.gethostname")
@mock.patch("certbot_nginx._internal.configurator.socket.gethostbyaddr")
- def test_get_all_names(self, mock_gethostbyaddr):
+ def test_get_all_names(self, mock_gethostbyaddr, mock_gethostname):
mock_gethostbyaddr.return_value = ('155.225.50.69.nephoscale.net', [], [])
+ mock_gethostname.return_value = ('example.net')
names = self.config.get_all_names()
self.assertEqual(names, {
"155.225.50.69.nephoscale.net", "www.example.org", "another.alias",
"migration.com", "summer.com", "geese.com", "sslon.com",
"globalssl.com", "globalsslsetssl.com", "ipv6.com", "ipv6ssl.com",
- "headers.com"})
+ "headers.com", "example.net"})
def test_supported_enhancements(self):
self.assertEqual(['redirect', 'ensure-http-header', 'staple-ocsp'],
diff --git a/certbot-nginx/tests/testdata/etc_nginx/sites-enabled/example.net b/certbot-nginx/tests/testdata/etc_nginx/sites-enabled/example.net
new file mode 100644
index 000000000..67d566fe6
--- /dev/null
+++ b/certbot-nginx/tests/testdata/etc_nginx/sites-enabled/example.net
@@ -0,0 +1,5 @@
+server {
+ listen 80;
+ listen [::]:80;
+ server_name $hostname;
+}