Example #1
0
 def test_hostname_translate(self):
     hostname = "<}\x1fh\x10e\x08l\x02l\x05o\x12!{>"
     self.assertEqual("hello", utils.sanitize_hostname(hostname))
Example #2
0
 def test_hostname_sanitize_dashes(self):
     hostname = "----test.example.com---"
     self.assertEqual("test.example.com",
                      utils.sanitize_hostname(hostname))
Example #3
0
 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))
Example #4
0
 def test_hostname_unicode_sanitization(self):
     hostname = u"\u7684.test.example.com"
     self.assertEqual("test.example.com",
                      utils.sanitize_hostname(hostname))
Example #5
0
 def test_hostname_sanitize_periods(self):
     hostname = "....test.example.com..."
     self.assertEqual("test.example.com",
                      utils.sanitize_hostname(hostname))
Example #6
0
 def test_hostname_translate(self):
     hostname = "<}\x1fh\x10e\x08l\x02l\x05o\x12!{>"
     self.assertEqual("hello", utils.sanitize_hostname(hostname))
Example #7
0
 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))
Example #8
0
 def test_hostname_sanitize_dashes(self):
     hostname = "----test.example.com---"
     self.assertEqual("test.example.com", utils.sanitize_hostname(hostname))
Example #9
0
 def test_hostname_sanitize_periods(self):
     hostname = "....test.example.com..."
     self.assertEqual("test.example.com", utils.sanitize_hostname(hostname))
Example #10
0
 def test_hostname_unicode_sanitization(self):
     hostname = u"\u7684.test.example.com"
     self.assertEqual("test.example.com", utils.sanitize_hostname(hostname))