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:
authorcumul0529 <gg6123@naver.com>2020-02-23 20:46:27 +0300
committercumul0529 <gg6123@naver.com>2020-02-23 20:46:27 +0300
commit36311a276b7ffbff9bcc8b019f6a12f97e153712 (patch)
treeea6063257c8378618f69ec7ece9b12e418fdeb6b
parent22685ef86fa2f00be647403f3c64cec79b4d2be1 (diff)
Add test case for `_parse_ssl_options()`
-rw-r--r--certbot-nginx/tests/parser_test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/certbot-nginx/tests/parser_test.py b/certbot-nginx/tests/parser_test.py
index d766a6a9b..a0484f965 100644
--- a/certbot-nginx/tests/parser_test.py
+++ b/certbot-nginx/tests/parser_test.py
@@ -497,6 +497,25 @@ class NginxParserTest(util.NginxTest):
parsed = nparser._parse_files(path)
self.assertEqual([], parsed)
+ def test_valid_unicode_characters_in_ssl_options(self):
+ nparser = parser.NginxParser(self.config_path)
+ path = nparser.abs_path('valid_unicode_comments.conf')
+ parsed = parser._parse_ssl_options(path) # pylint: disable=protected-access
+ self.assertEqual(['server'], parsed[2][0])
+ self.assertEqual(['listen', '80'], parsed[2][1][3])
+
+ def test_invalid_unicode_characters_in_ssl_options(self):
+ with self.assertLogs() as log:
+ nparser = parser.NginxParser(self.config_path)
+ path = nparser.abs_path('invalid_unicode_comments.conf')
+ parsed = parser._parse_ssl_options(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)
+ ])
if __name__ == "__main__":
unittest.main() # pragma: no cover