mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
[Tests] Require exact match in assert_start_raises_init_eror()
This commit is contained in:
@ -4,9 +4,12 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test the -uacomment option."""
|
||||
|
||||
import re
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal
|
||||
|
||||
|
||||
class UacommentTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
@ -23,13 +26,14 @@ class UacommentTest(BitcoinTestFramework):
|
||||
|
||||
self.log.info("test -uacomment max length")
|
||||
self.stop_node(0)
|
||||
expected = "exceeds maximum length (256). Reduce the number or size of uacomments."
|
||||
expected = "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(["-uacomment=" + 'a' * 256], expected)
|
||||
|
||||
self.log.info("test -uacomment unsafe characters")
|
||||
for unsafe_char in ['/', ':', '(', ')']:
|
||||
expected = "User Agent comment (" + unsafe_char + ") contains unsafe characters"
|
||||
expected = "Error: User Agent comment \(" + re.escape(unsafe_char) + "\) contains unsafe characters."
|
||||
self.nodes[0].assert_start_raises_init_error(["-uacomment=" + unsafe_char], expected)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
UacommentTest().main()
|
||||
|
Reference in New Issue
Block a user