def testHostname(self): valid_hostnames = [ u'i-123445', u'5dfsdfsdrrfsv', u'432498234234A' u'234234235235235235', # Couldn't find anything in the RFC saying it's not valid u'A45fsdff045-dsflk4dfsdc.ret43tjssfd', u'4354sfsdkfj4TEfdlv56gdgdfRET.dsf-dg', u'r' * 255, ] not_valid_hostnames = [ u'abc' * 150, u'sdf4..sfsd', u'$42sdf', u'.sfdsfds' u's™£™£¢ª•ªdfésdfs' ] for hostname in valid_hostnames: self.assertTrue(util.is_valid_hostname(hostname), hostname) for hostname in not_valid_hostnames: self.assertFalse(util.is_valid_hostname(hostname), hostname)
def testHostname(self): valid_hostnames = [ u'i-123445', u'5dfsdfsdrrfsv', u'432498234234A' u'234234235235235235', # Couldn't find anything in the RFC saying it's not valid u'A45fsdff045-dsflk4dfsdc.ret43tjssfd', u'4354sfsdkfj4TEfdlv56gdgdfRET.dsf-dg', u'r' * 255, ] not_valid_hostnames = [ u'abc' * 150, u'sdf4..sfsd', u'$42sdf', u'.sfdsfds' u's™£™£¢ª•ªdfésdfs' ] for hostname in valid_hostnames: self.assertTrue(is_valid_hostname(hostname), hostname) for hostname in not_valid_hostnames: self.assertFalse(is_valid_hostname(hostname), hostname)