From 9522d847d72d0e41d5ddf4a59f2777da8faecddb Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Wed, 15 Jul 2015 15:57:51 +0000 Subject: [PATCH] Mock external resource in nginx plugin tests. External DNS entry has been updated causing test failures, e.g. https://travis-ci.org/kuba/letsencrypt/builds/71101879. --- .../letsencrypt_nginx/tests/configurator_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py b/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py index 2b7a4e08e..d8f82bd05 100644 --- a/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py +++ b/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py @@ -34,7 +34,9 @@ class NginxConfiguratorTest(util.NginxTest): self.assertEquals((1, 6, 2), self.config.version) self.assertEquals(5, len(self.config.parser.parsed)) - def test_get_all_names(self): + @mock.patch("letsencrypt_nginx.configurator.socket.gethostbyaddr") + def test_get_all_names(self, mock_gethostbyaddr): + mock_gethostbyaddr.return_value = ('155.225.50.69.nephoscale.net', [], []) names = self.config.get_all_names() self.assertEqual(names, set( ["*.www.foo.com", "somename", "another.alias",