diff options
author | cumul0529 <gg6123@naver.com> | 2020-02-23 20:47:44 +0300 |
---|---|---|
committer | cumul0529 <gg6123@naver.com> | 2020-02-23 20:48:55 +0300 |
commit | 20df5507ae9a17df35f9c1152a34d0c52ba304f6 (patch) | |
tree | 4200bcab9213c8c82dc353d10888e2ef45a574dc | |
parent | 36311a276b7ffbff9bcc8b019f6a12f97e153712 (diff) |
Add logging test for `_parse_files()`
-rw-r--r-- | certbot-nginx/tests/parser_test.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/certbot-nginx/tests/parser_test.py b/certbot-nginx/tests/parser_test.py index a0484f965..89bcf689a 100644 --- a/certbot-nginx/tests/parser_test.py +++ b/certbot-nginx/tests/parser_test.py @@ -491,11 +491,17 @@ class NginxParserTest(util.NginxTest): self.assertEqual(['listen', '80'], parsed[0][2][1][3]) def test_invalid_unicode_characters(self): - nparser = parser.NginxParser(self.config_path) - # pylint: disable=protected-access - path = nparser.abs_path('invalid_unicode_comments.conf') - parsed = nparser._parse_files(path) + with self.assertLogs() as log: + nparser = parser.NginxParser(self.config_path) + path = nparser.abs_path('invalid_unicode_comments.conf') + parsed = nparser._parse_files(path) # pylint: disable=protected-access + self.assertEqual([], parsed) + self.assertTrue([ + True + for output in log.output + if ('invalid character' in output) and ('UTF-8' in output) + ]) def test_valid_unicode_characters_in_ssl_options(self): nparser = parser.NginxParser(self.config_path) |