Skip to content

Commit

Permalink
Chore: testing bridge_rpc errorhandling (#2055)
Browse files Browse the repository at this point in the history
  • Loading branch information
k9ert authored Jan 17, 2023
1 parent db8e413 commit 31954a5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_specterext_spectrum_bridge_rpc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from unittest.mock import MagicMock
from cryptoadvance.specterext.spectrum.bridge_rpc import BridgeRPC
from cryptoadvance.spectrum.spectrum import RPCError as SpectrumRpcError
from cryptoadvance.specter.rpc import RpcError as SpecterRpcError
from flask import Flask
import pytest

Expand Down Expand Up @@ -36,3 +39,15 @@ def test_getmininginfobridge(caplog, app: Flask):
assert data["walletname"] == "some_test_wallet_name_123"

# assert False


def test_exceptionHandling():
spectrum_mock: MagicMock = MagicMock()
spectrum_mock.walletcreatefundedpsbt.side_effect = SpectrumRpcError("Muh")

with pytest.raises(SpectrumRpcError):
spectrum_mock.walletcreatefundedpsbt("muh", "meh")

brpc = BridgeRPC(spectrum_mock)
with pytest.raises(SpecterRpcError):
brpc.walletcreatefundedpsbt()

0 comments on commit 31954a5

Please sign in to comment.