| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0cc7378 commit 9581334
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | # coding=utf-8 | |
| 3 | 3 | ||
| 4 | 4 | from binance.client import Client | |
| 5 | - from binance.exceptions import BinanceAPIException, BinanceRequestException | ||
| 5 | + from binance.exceptions import BinanceAPIException, BinanceRequestException, BinanceWithdrawException | ||
| 6 | 6 | import pytest | |
| 7 | 7 | import requests_mock | |
| 8 | 8 | ||
@@ -27,3 +27,14 @@ def test_api_exception(): | |||
| 27 | 27 | json_obj = {"code": 1002, "msg": "Invalid API call"} | |
| 28 | 28 | m.get('https://www.binance.com/api/v1/time', json=json_obj, status_code=400) | |
| 29 | 29 | 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) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments