Must read config file before chdir into lightning dir
(node_factory)
| 1525 | |
| 1526 | |
| 1527 | def 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 | |
| 1550 | def test_json_error(node_factory): |