Skip to content

Commit

Permalink
sauron: Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ca-ruz committed Nov 6, 2024
1 parent c323fce commit f03e468
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
6 changes: 4 additions & 2 deletions sauron/tests/test_sauron_esplora_bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self, *args, **kwargs):
pyln.testing.utils.TEST_NETWORK = "bitcoin"
utils.LightningNode.__init__(self, *args, **kwargs)
lightning_dir = args[1]

self.daemon = LightningD(lightning_dir, None) # noqa: F405
self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405
options = {
"disable-plugin": "bcli",
"network": "bitcoin",
Expand Down Expand Up @@ -111,6 +110,7 @@ def test_rpc_estimatefees(node_factory):
"""
Test estimatefees
"""

ln_node = node_factory.get_node()

# Sample response
Expand All @@ -133,6 +133,8 @@ def test_rpc_estimatefees(node_factory):
# }
response = ln_node.rpc.call("estimatefees")



expected_response_keys = [
"opening",
"mutual_close",
Expand Down
12 changes: 5 additions & 7 deletions sauron/tests/test_sauron_esplora_signet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self, *args, **kwargs):
pyln.testing.utils.TEST_NETWORK = "signet"
utils.LightningNode.__init__(self, *args, **kwargs)
lightning_dir = args[1]

self.daemon = LightningD(lightning_dir, None) # noqa: F405
self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405
options = {
"disable-plugin": "bcli",
"network": "signet",
Expand Down Expand Up @@ -74,16 +73,15 @@ def test_rpc_sendrawtransaction_invalid(node_factory):
"""
ln_node = node_factory.get_node()

expected_response = {
"errmsg": 'sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed. Make sure the tx has at least one input."}',
"success": False,
}
expected_error_substring = "RPC error"

response = ln_node.rpc.call(
"sendrawtransaction",
{"tx": "invalid-raw-tx"},
)

assert response == expected_response
assert expected_error_substring in response.get("errmsg", ""), "Expected 'RPC error' in errmsg field"
assert response.get("success") is False, "Expected success to be False"


def test_rpc_getutxout(node_factory):
Expand Down
12 changes: 5 additions & 7 deletions sauron/tests/test_sauron_esplora_testnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self, *args, **kwargs):
pyln.testing.utils.TEST_NETWORK = "testnet"
utils.LightningNode.__init__(self, *args, **kwargs)
lightning_dir = args[1]

self.daemon = LightningD(lightning_dir, None) # noqa: F405
self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405
options = {
"disable-plugin": "bcli",
"network": "testnet",
Expand Down Expand Up @@ -74,16 +73,15 @@ def test_rpc_sendrawtransaction_invalid(node_factory):
"""
ln_node = node_factory.get_node()

expected_response = {
"errmsg": 'sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed. Make sure the tx has at least one input."}',
"success": False,
}
expected_error_substring = "RPC error"

response = ln_node.rpc.call(
"sendrawtransaction",
{"tx": "invalid-raw-tx"},
)

assert response == expected_response
assert expected_error_substring in response.get("errmsg", ""), "Expected 'RPC error' in errmsg field"
assert response.get("success") is False, "Expected success to be False"


def test_rpc_getutxout(node_factory):
Expand Down
3 changes: 1 addition & 2 deletions sauron/tests/test_sauron_esplora_tor_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self, *args, **kwargs):
pyln.testing.utils.TEST_NETWORK = "bitcoin"
utils.LightningNode.__init__(self, *args, **kwargs)
lightning_dir = args[1]

self.daemon = LightningD(lightning_dir, None) # noqa: F405
self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405
options = {
"disable-plugin": "bcli",
"network": "bitcoin",
Expand Down
3 changes: 1 addition & 2 deletions sauron/tests/test_sauron_mempoolspace_signet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self, *args, **kwargs):
pyln.testing.utils.TEST_NETWORK = "signet"
utils.LightningNode.__init__(self, *args, **kwargs)
lightning_dir = args[1]

self.daemon = LightningD(lightning_dir, None) # noqa: F405
self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405
options = {
"disable-plugin": "bcli",
"network": "signet",
Expand Down

0 comments on commit f03e468

Please sign in to comment.