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

Function test_configfile_before_chdir

tests/test_misc.py:1527–1547  ·  view source on GitHub ↗

Must read config file before chdir into lightning dir

(node_factory)

Source from the content-addressed store, hash-verified

1525
1526
1527def test_configfile_before_chdir(node_factory):
1528 """Must read config file before chdir into lightning dir"""
1529 l1 = node_factory.get_node()
1530 l1.stop()
1531
1532 olddir = os.getcwd()
1533 # as lightning_dir ends in /, basename and dirname don't work as expected.
1534 os.chdir(os.path.dirname(l1.daemon.lightning_dir[:-1]))
1535 config = os.path.join(os.path.basename(l1.daemon.lightning_dir[:-1]), TEST_NETWORK, "test_configfile")
1536 # Test both an early arg and a normal arg.
1537 with open(config, 'wb') as f:
1538 f.write(b'always-use-proxy=true\n')
1539 f.write(b'proxy=127.0.0.1:100\n')
1540 l1.daemon.opts['conf'] = config
1541
1542 # Update executable to point to right place
1543 l1.daemon.executable = os.path.join(olddir, l1.daemon.executable)
1544 l1.start()
1545 assert l1.rpc.listconfigs()['always-use-proxy']
1546 assert l1.rpc.listconfigs()['proxy'] == '127.0.0.1:100'
1547 os.chdir(olddir)
1548
1549
1550def test_json_error(node_factory):

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
listconfigsMethod · 0.80
get_nodeMethod · 0.45
stopMethod · 0.45
writeMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected