コード例 #1
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_hostname_translate(self):
     hostname = "<}\x1fh\x10e\x08l\x02l\x05o\x12!{>"
     self.assertEqual("hello", utils.sanitize_hostname(hostname))
コード例 #2
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_hostname_sanitize_dashes(self):
     hostname = "----test.example.com---"
     self.assertEqual("test.example.com", utils.sanitize_hostname(hostname))
コード例 #3
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_hostname_sanitize_characters(self):
     hostname = "(#@&$!(@*--#&91)(__=+--test-host.example!!.com-0+"
     self.assertEqual("91----test-host.example.com-0",
                      utils.sanitize_hostname(hostname))
コード例 #4
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_hostname_unicode_sanitization(self):
     hostname = u"\u7684.test.example.com"
     self.assertEqual("test.example.com", utils.sanitize_hostname(hostname))
コード例 #5
0
ファイル: test_utils.py プロジェクト: 2Exception/patron
 def test_hostname_sanitize_periods(self):
     hostname = "....test.example.com..."
     self.assertEqual("test.example.com", utils.sanitize_hostname(hostname))
コード例 #6
0
ファイル: test_utils.py プロジェクト: hsluoyz/patron
 def test_hostname_translate(self):
     hostname = "<}\x1fh\x10e\x08l\x02l\x05o\x12!{>"
     self.assertEqual("hello", utils.sanitize_hostname(hostname))
コード例 #7
0
ファイル: test_utils.py プロジェクト: hsluoyz/patron
 def test_hostname_sanitize_characters(self):
     hostname = "(#@&$!(@*--#&91)(__=+--test-host.example!!.com-0+"
     self.assertEqual("91----test-host.example.com-0",
                      utils.sanitize_hostname(hostname))
コード例 #8
0
ファイル: test_utils.py プロジェクト: hsluoyz/patron
 def test_hostname_sanitize_dashes(self):
     hostname = "----test.example.com---"
     self.assertEqual("test.example.com",
                      utils.sanitize_hostname(hostname))
コード例 #9
0
ファイル: test_utils.py プロジェクト: hsluoyz/patron
 def test_hostname_sanitize_periods(self):
     hostname = "....test.example.com..."
     self.assertEqual("test.example.com",
                      utils.sanitize_hostname(hostname))
コード例 #10
0
ファイル: test_utils.py プロジェクト: hsluoyz/patron
 def test_hostname_unicode_sanitization(self):
     hostname = u"\u7684.test.example.com"
     self.assertEqual("test.example.com",
                      utils.sanitize_hostname(hostname))