diff --git a/pyhmy/blockchain.py b/pyhmy/blockchain.py index a989be1..4559840 100644 --- a/pyhmy/blockchain.py +++ b/pyhmy/blockchain.py @@ -718,9 +718,9 @@ def get_total_supply( """ method = "hmyv2_getTotalSupply" try: - rpc_request( method, - endpoint = endpoint, - timeout = timeout )[ "result" ] + return rpc_request( method, + endpoint = endpoint, + timeout = timeout )[ "result" ] except KeyError as exception: raise InvalidRPCReplyError( method, endpoint ) from exception diff --git a/tests/request-pyhmy/test_blockchain_return_values.py b/tests/request-pyhmy/test_blockchain_return_values.py new file mode 100644 index 0000000..779bc1b --- /dev/null +++ b/tests/request-pyhmy/test_blockchain_return_values.py @@ -0,0 +1,13 @@ +from pyhmy import blockchain + + +def test_get_total_supply_returns_rpc_result( monkeypatch ): + expected = "15260238647.49999999480981481" + + def mock_rpc_request( method, endpoint = None, timeout = None ): + assert method == "hmyv2_getTotalSupply" + return { "result": expected } + + monkeypatch.setattr( blockchain, "rpc_request", mock_rpc_request ) + + assert blockchain.get_total_supply() == expected