Skip to content

Commit

Permalink
Add a test for electrum handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidson-Souza committed Feb 13, 2023
1 parent 9afcbe3 commit e05f12d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions tests/electrum_handshake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import time

from test_framework.electrum_client import ElectrumClient
from test_framework.test_framework import TestFramework


class ElectrumHandshakeTest(TestFramework):
def run_test(self):
try:
self.run_rpc()
time.sleep(5)
self.run_node("./data/handshake/", "signet")
time.sleep(4)
client = ElectrumClient("localhost", 50001)
version = client.get_version()
assert (
b'{"id":0,"jsonrpc":"2.0","result":["ElectrumX 1.16.0","1.4"]}' == version)
except ConnectionRefusedError:
print("Unable to connect with the electrum server")
exit(1)
except AssertionError:
print("Got an invalid response")
exit(1)
finally:
self.stop_node(0)


if __name__ == "__main__":
ElectrumHandshakeTest().run_test()
2 changes: 1 addition & 1 deletion tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

BASE_DIR = "/tmp/data"

tests = ["example_test", "restart"]
tests = ["example_test", "restart", "electrum_handshake"]


def main():
Expand Down

0 comments on commit e05f12d

Please sign in to comment.