FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add test for withdraw exception response · EncodingJerry/python-binance@9581334 · GitHub

Commit 9581334

Browse files
Sam McHardy
committed
Add test for withdraw exception response
1 parent 0cc7378 commit 9581334

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎tests/test_api_request.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# coding=utf-8
33

44
from binance.client import Client
5-
from binance.exceptions import BinanceAPIException, BinanceRequestException
5+
from binance.exceptions import BinanceAPIException, BinanceRequestException, BinanceWithdrawException
66
import pytest
77
import requests_mock
88

@@ -27,3 +27,14 @@ def test_api_exception():
2727
json_obj = {"code": 1002, "msg": "Invalid API call"}
2828
m.get('https://www.binance.com/api/v1/time', json=json_obj, status_code=400)
2929
client.get_server_time()
30+
31+
32+
def test_withdraw_api_exception():
33+
"""Test Withdraw API response Exception"""
34+
35+
with pytest.raises(BinanceWithdrawException):
36+
37+
with requests_mock.mock() as m:
38+
json_obj = {"success": False, "msg": "Insufficient funds"}
39+
m.register_uri('POST', requests_mock.ANY, json=json_obj, status_code=200)
40+
client.withdraw(asset='BTC', address='BTCADDRESS', amount=100)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL