mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
Add validate-hostname tests from ircdocs/parser-tests
This commit is contained in:
parent
b803c23b57
commit
462fa91622
@ -23,6 +23,8 @@ class MessageParserTest(unittest.TestCase):
|
||||
cls.USER_HOST_SPLIT_TEST_DATA = yaml.safe_load(f)
|
||||
with open(PARSER_DATA_PATH / 'mask-match.yaml') as f:
|
||||
cls.MASK_MATCH_TEST_DATA = yaml.safe_load(f)
|
||||
with open(PARSER_DATA_PATH / 'validate-hostname.yaml') as f:
|
||||
cls.VALIDATE_HOSTNAME_TEST_DATA = yaml.safe_load(f)
|
||||
|
||||
def testMessageSplit(self):
|
||||
for testdata in self.MESSAGE_SPLIT_TEST_DATA['tests']:
|
||||
@ -92,5 +94,14 @@ class MessageParserTest(unittest.TestCase):
|
||||
with self.subTest():
|
||||
self.assertFalse(utils.match_text(mask, fail))
|
||||
|
||||
def testValidateHostname(self):
|
||||
for test in self.VALIDATE_HOSTNAME_TEST_DATA['tests']:
|
||||
with self.subTest():
|
||||
self.assertEqual(test['valid'], IRCCommonProtocol.is_server_name(test['host']),
|
||||
"Failed test for %r; should be %s" % (test['host'], test['valid']))
|
||||
|
||||
|
||||
# N.B. skipping msg-join tests because PyLink doesn't think about messages that way
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user