mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:14:54 +02:00
Added test for valid/invalid unicode characters
This commit is contained in:
@@ -482,6 +482,18 @@ class NginxParserTest(util.NginxTest):
|
||||
called = True
|
||||
self.assertTrue(called)
|
||||
|
||||
def test_valid_unicode_characters(self):
|
||||
nparser = parser.NginxParser(self.config_path)
|
||||
# pylint: disable=protected-access
|
||||
parsed = nparser._parse_files(nparser.abs_path('unicode_support/valid_unicode_comments.conf'))
|
||||
self.assertEqual(['server'], parsed[0][2][0])
|
||||
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
|
||||
parsed = nparser._parse_files(nparser.abs_path('unicode_support/invalid_unicode_comments.conf'))
|
||||
self.assertEqual([], parsed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# This configuration file is saved with EUC-KR (a.k.a. cp949) encoding,
|
||||
# including some Korean alphabets.
|
||||
|
||||
server {
|
||||
# 안녕하세요. 80번 포트에서 요청을 기다린다.
|
||||
listen 80;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# This configuration file is saved with valid UTF-8 encoding,
|
||||
# including some CJK alphabets.
|
||||
|
||||
server {
|
||||
# 안녕하세요. 80번 포트에서 요청을 기다린다.
|
||||
# こんにちは。80番ポートからリクエストを待つ。
|
||||
# 你好。等待端口80上的请求。
|
||||
listen 80;
|
||||
}
|
||||
Reference in New Issue
Block a user