Skip to content

Commit f0729c6

Browse files
committed
Use node factory
1 parent e0e6603 commit f0729c6

4 files changed

Lines changed: 22 additions & 16 deletions

File tree

sauron/tests/test_sauron_esplora.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ def node_cls(monkeypatch):
3636
yield LightningNode
3737

3838

39-
def test_rpc_getchaininfo(ln_node):
39+
def test_rpc_getchaininfo(node_factory):
4040
"""
4141
Test getchaininfo
4242
"""
43+
ln_node = node_factory.get_node()
4344

4445
response = ln_node.rpc.call("getchaininfo")
4546

@@ -51,10 +52,11 @@ def test_rpc_getchaininfo(ln_node):
5152
assert not response["ibd"]
5253

5354

54-
def test_rpc_getrawblockbyheight(ln_node):
55+
def test_rpc_getrawblockbyheight(node_factory):
5556
"""
5657
Test getrawblockbyheight
5758
"""
59+
ln_node = node_factory.get_node()
5860

5961
response = ln_node.rpc.call("getrawblockbyheight", {"height": 0})
6062

@@ -65,10 +67,11 @@ def test_rpc_getrawblockbyheight(ln_node):
6567
assert response == expected_response
6668

6769

68-
def test_rpc_sendrawtransaction_invalid(ln_node):
70+
def test_rpc_sendrawtransaction_invalid(node_factory):
6971
"""
7072
Test sendrawtransaction
7173
"""
74+
ln_node = node_factory.get_node()
7275

7376
expected_response = {
7477
"errmsg": 'sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed. Make sure the tx has at least one input."}',
@@ -82,10 +85,11 @@ def test_rpc_sendrawtransaction_invalid(ln_node):
8285
assert response == expected_response
8386

8487

85-
def test_rpc_getutxout(ln_node):
88+
def test_rpc_getutxout(node_factory):
8689
"""
8790
Test getutxout
8891
"""
92+
ln_node = node_factory.get_node()
8993

9094
expected_response = {
9195
"amount": 1000000000,
@@ -102,10 +106,11 @@ def test_rpc_getutxout(ln_node):
102106
assert response == expected_response
103107

104108

105-
def test_rpc_estimatefees(ln_node):
109+
def test_rpc_estimatefees(node_factory):
106110
"""
107111
Test estimatefees
108112
"""
113+
ln_node = node_factory.get_node()
109114

110115
# Sample response
111116
# {

sauron/tests/test_sauron_esplora_tor_proxy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ def node_cls(monkeypatch):
3737
yield LightningNode
3838

3939
@pytest.mark.skip(reason="TODO: Mock tor")
40-
def test_tor_proxy(ln_node):
40+
def test_tor_proxy(node_factory):
4141
"""
4242
Test for tor proxy
4343
"""
44+
ln_node = node_factory.get_node()
4445

4546
assert ln_node.daemon.opts["sauron-tor-proxy"] == "localhost:9050"
4647
assert ln_node.daemon.is_in_log("Using proxy socks5h://localhost:9050 for requests")

sauron/tests/test_sauron_mempoolspace.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ def node_cls(monkeypatch):
3636
yield LightningNode
3737

3838

39-
def test_rpc_getchaininfo(ln_node):
39+
def test_rpc_getchaininfo(node_factory):
4040
"""
4141
Test getchaininfo
4242
"""
43+
ln_node = node_factory.get_node()
4344

4445
response = ln_node.rpc.call("getchaininfo")
4546

@@ -51,10 +52,11 @@ def test_rpc_getchaininfo(ln_node):
5152
assert not response["ibd"]
5253

5354

54-
def test_rpc_getrawblockbyheight(ln_node):
55+
def test_rpc_getrawblockbyheight(node_factory):
5556
"""
5657
Test getrawblockbyheight
5758
"""
59+
ln_node = node_factory.get_node()
5860

5961
response = ln_node.rpc.call("getrawblockbyheight", {"height": 0})
6062

@@ -65,10 +67,11 @@ def test_rpc_getrawblockbyheight(ln_node):
6567
assert response == expected_response
6668

6769

68-
def test_rpc_sendrawtransaction_invalid(ln_node):
70+
def test_rpc_sendrawtransaction_invalid(node_factory):
6971
"""
7072
Test sendrawtransaction
7173
"""
74+
ln_node = node_factory.get_node()
7275

7376
expected_response = {
7477
"errmsg": 'sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed. Make sure the tx has at least one input."}',
@@ -82,10 +85,11 @@ def test_rpc_sendrawtransaction_invalid(ln_node):
8285
assert response == expected_response
8386

8487

85-
def test_rpc_getutxout(ln_node):
88+
def test_rpc_getutxout(node_factory):
8689
"""
8790
Test getutxout
8891
"""
92+
ln_node = node_factory.get_node()
8993

9094
expected_response = {
9195
"amount": 5000000000,
@@ -102,10 +106,11 @@ def test_rpc_getutxout(ln_node):
102106
assert response == expected_response
103107

104108

105-
def test_rpc_estimatefees(ln_node):
109+
def test_rpc_estimatefees(node_factory):
106110
"""
107111
Test estimatefees
108112
"""
113+
ln_node = node_factory.get_node()
109114

110115
# Sample response
111116
# {

sauron/tests/util.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,3 @@ def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False):
2727
if wait_for_initialized:
2828
self.wait_for_log("Server started with public key")
2929
logging.info("LightningD started")
30-
31-
32-
@pytest.fixture
33-
def ln_node(node_factory): # noqa: F811
34-
yield node_factory.get_node()

0 commit comments

Comments
 (0)