Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
add new test
Browse files Browse the repository at this point in the history
  • Loading branch information
Benzbeeb committed Mar 9, 2021
1 parent ce887c8 commit 01b3895
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion helpers/pyband/tests/client/send_tx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
TransactionBlockMode,
HexBytes,
)
from requests.exceptions import ReadTimeout
from unittest.mock import patch

TEST_RPC = "https://api-mock.bandprotocol.com/rest"
TEST_MSG = {
Expand Down Expand Up @@ -68,7 +70,28 @@
}


client = Client(TEST_RPC)
client = Client(TEST_RPC, 3)


@patch("requests.post")
def test_send_tx_sync_mode_timeout(requests_mock):
requests_mock.side_effect = ReadTimeout
with pytest.raises(ReadTimeout):
res = client.send_tx_sync_mode(TEST_MSG)


@patch("requests.post")
def test_send_tx_block_mode_timeout(requests_mock):
requests_mock.side_effect = ReadTimeout
with pytest.raises(ReadTimeout):
res = client.send_tx_block_mode(TEST_MSG)


@patch("requests.post")
def test_send_tx_async_mode_timeout(requests_mock):
requests_mock.side_effect = ReadTimeout
with pytest.raises(ReadTimeout):
res = client.send_tx_async_mode(TEST_MSG)


def test_send_tx_sync_mode_success(requests_mock):
Expand Down

0 comments on commit 01b3895

Please sign in to comment.