commit fafe8ca534194414392c99d80d54ac1dd687861f
parent 810a5f87f822eefb97d1e182909dfb0ba301decd
Author: parazyd <parazyd@dyne.org>
Date: Mon, 19 Apr 2021 19:49:58 +0200
Cover protocol/handle_query in test case.
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/tests/test_electrum_protocol.py b/tests/test_electrum_protocol.py
@@ -399,6 +399,21 @@ async def test_send_reply(protocol, writer, method):
assert_equal(writer.mock, expect)
+async def test_handle_query(protocol, writer, method):
+ query = {"jsonrpc": "2.0", "method": method, "id": 42, "params": []}
+ await protocol.handle_query(writer, query)
+
+ method = "server.donation_address"
+ query = {"jsonrpc": "2.0", "method": method, "id": 42, "params": []}
+ await protocol.handle_query(writer, query)
+
+ query = {"jsonrpc": "2.0", "method": method, "params": []}
+ await protocol.handle_query(writer, query)
+
+ query = {"jsonrpc": "2.0", "id": 42, "params": []}
+ await protocol.handle_query(writer, query)
+
+
class MockTransport:
def __init__(self):
@@ -450,6 +465,7 @@ orchestration = {
"server.peers_subscribe": test_peers_subscribe,
"_send_notification": test_send_notification,
"_send_reply": test_send_reply,
+ "_handle_query": test_handle_query,
}