MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_static_tor_onions

Function test_static_tor_onions

tests/test_gossip.py:1880–1912  ·  view source on GitHub ↗

First basic tests ;-) Assume that tor is configured and just test if we see the right onion address for our blob

(node_factory)

Source from the content-addressed store, hash-verified

1878
1879
1880def test_static_tor_onions(node_factory):
1881 """First basic tests ;-)
1882
1883 Assume that tor is configured and just test
1884 if we see the right onion address for our blob
1885 """
1886 # please define your values
1887 torip = '127.0.0.1'
1888 torips = '127.0.0.1:9051'
1889 torport = 9050
1890 torserviceport = 9051
1891
1892 if not check_socket(format(torip), torserviceport):
1893 return
1894
1895 if not check_socket(format(torip), torport):
1896 return
1897
1898 portA = node_factory.get_unused_port()
1899 l1 = node_factory.get_node(may_fail=True, options={
1900 'bind-addr': '127.0.0.1:{}'.format(portA),
1901 'addr': ['statictor:{}'.format(torips)]
1902 })
1903 portB = node_factory.get_unused_port()
1904 l2 = node_factory.get_node(may_fail=True, options={
1905 'bind-addr': '127.0.0.1:{}'.format(portB),
1906 'addr': ['statictor:{}/torblob=11234567890123456789012345678901/torport={}'.format(torips, 9736)]
1907 })
1908
1909 assert l1.daemon.is_in_log('127.0.0.1:{}'.format(l1.port))
1910 # Did not specify torport, so it's the default.
1911 assert l1.daemon.is_in_log('.onion:{}'.format(default_ln_port(l1.info["network"])))
1912 assert l2.daemon.is_in_log('x2y4zvh4fn5q3eouuh7nxnc7zeawrqoutljrup2xjtiyxgx3emgkemad.onion:{},127.0.0.1:{}'.format(9736, l2.port))
1913
1914
1915def test_tor_port_onions(node_factory):

Callers

nothing calls this directly

Calls 6

default_ln_portFunction · 0.90
check_socketFunction · 0.85
formatEnum · 0.85
get_unused_portMethod · 0.80
is_in_logMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected