Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_uacomment.py
Show All 26 Lines | def run_test(self): | ||||
self.log.info("test -uacomment max length") | self.log.info("test -uacomment max length") | ||||
self.stop_node(0) | self.stop_node(0) | ||||
expected = r"Error: Total length of network version string \([0-9]+\) exceeds maximum length \(256\). Reduce the number or size of uacomments." | expected = r"Error: Total length of network version string \([0-9]+\) exceeds maximum length \(256\). Reduce the number or size of uacomments." | ||||
self.nodes[0].assert_start_raises_init_error( | self.nodes[0].assert_start_raises_init_error( | ||||
["-uacomment=" + 'a' * 256], expected, match=ErrorMatch.FULL_REGEX) | ["-uacomment=" + 'a' * 256], expected, match=ErrorMatch.FULL_REGEX) | ||||
self.log.info("test -uacomment unsafe characters") | self.log.info("test -uacomment unsafe characters") | ||||
for unsafe_char in ['/', ':', '(', ')']: | for unsafe_char in ['/', ':', '(', ')', '₿', '🏃']: | ||||
expected = r"Error: User Agent comment \(" + re.escape( | expected = r"Error: User Agent comment \(" + re.escape( | ||||
unsafe_char) + r"\) contains unsafe characters." | unsafe_char) + r"\) contains unsafe characters." | ||||
self.nodes[0].assert_start_raises_init_error( | self.nodes[0].assert_start_raises_init_error( | ||||
["-uacomment=" + unsafe_char], expected, match=ErrorMatch.FULL_REGEX) | ["-uacomment=" + unsafe_char], expected, match=ErrorMatch.FULL_REGEX) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
UacommentTest().main() | UacommentTest().main() |