diff options
author | Erica Portnoy <ebportnoy@gmail.com> | 2018-03-27 01:31:15 +0300 |
---|---|---|
committer | Erica Portnoy <ebportnoy@gmail.com> | 2018-03-27 01:31:15 +0300 |
commit | 6c168d4e7e16b7e4d771d64495465a8643e9e475 (patch) | |
tree | 40a573fdc8fb962d22778559181ebd5b6b802e1d | |
parent | 83c5a0f665512a3338aeb2e7400db6b5b88554fd (diff) |
add test to make sure ipv6only=on is not erroneously removedipv6onlydup
-rw-r--r-- | certbot-nginx/certbot_nginx/tests/parser_test.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/certbot-nginx/certbot_nginx/tests/parser_test.py b/certbot-nginx/certbot_nginx/tests/parser_test.py index 4f83981ab..1e9703185 100644 --- a/certbot-nginx/certbot_nginx/tests/parser_test.py +++ b/certbot-nginx/certbot_nginx/tests/parser_test.py @@ -452,12 +452,24 @@ class NginxParserTest(util.NginxTest): #pylint: disable=too-many-public-methods nparser = parser.NginxParser(self.config_path) vhosts = nparser.get_vhosts() - default = [x for x in vhosts if 'ipv6ssl' in x.filep][0] - new_vhost = nparser.duplicate_vhost(default, remove_singleton_listen_params=True) + ipv6ssl = [x for x in vhosts if 'ipv6ssl' in x.filep][0] + new_vhost = nparser.duplicate_vhost(ipv6ssl, remove_singleton_listen_params=True) nparser.filedump(ext='') for addr in new_vhost.addrs: - self.assertFalse(addr.ipv6only) + self.assertFalse(addr.ipv6only) + + identical_vhost = nparser.duplicate_vhost(ipv6ssl, remove_singleton_listen_params=False) + nparser.filedump(ext='') + + called = False + for addr in identical_vhost.addrs: + if addr.ipv6: + self.assertTrue(addr.ipv6only) + called = True + self.assertTrue(called) + + if __name__ == "__main__": unittest.main() # pragma: no cover |