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