@@ -112,3 +112,146 @@ def test_market_data_v2(api, public_api_query_mock):
112112 """ Should use the old marketdata method if v2 is not set to True. """
113113 api .market_data (v2 = True )
114114 public_api_query_mock .assert_called_with ('marketdatav2' )
115+
116+
117+ def test_order_book_data_no_marketid (api , public_api_query_mock ):
118+ """ Should call orderdata if no marketid is provided. """
119+ api .order_book_data ()
120+ public_api_query_mock .assert_called_with ('orderdata' )
121+
122+
123+ def test_order_book_data_with_marketid (api , public_api_query_mock ):
124+ """ Should call singleorderdata if marketid is provided. """
125+ api .order_book_data (marketid = 10 )
126+ public_api_query_mock .assert_called_with ('singleorderdata' , marketid = 10 )
127+
128+
129+ def test_info (api , api_query_mock ):
130+ """ Should call getinfo. """
131+ api .info ()
132+ api_query_mock .assert_called_with ('getinfo' )
133+
134+
135+ def test_markets (api , api_query_mock ):
136+ """ Should call getmarkets. """
137+ api .markets ()
138+ api_query_mock .assert_called_with ('getmarkets' )
139+
140+
141+ def test_my_transactions (api , api_query_mock ):
142+ """ Should call mytransactions. """
143+ api .my_transactions ()
144+ api_query_mock .assert_called_with ('mytransactions' )
145+
146+
147+ def test_market_trades (api , api_query_mock ):
148+ """ Should call markettrades with the provided marketid. """
149+ api .market_trades (marketid = 10 )
150+ api_query_mock .assert_called_with ('markettrades' ,
151+ request_data = {'marketid' : 10 })
152+
153+
154+ def test_market_orders (api , api_query_mock ):
155+ """ Should call mytransactions. """
156+ api .market_orders (marketid = 10 )
157+ api_query_mock .assert_called_with ('marketorders' ,
158+ request_data = {'marketid' : 10 })
159+
160+
161+ def test_my_trades_no_marketid (api , api_query_mock ):
162+ """ If no marketid is provided, it should call allmytrades. """
163+ api .my_trades ()
164+ api_query_mock .assert_called_with ('allmytrades' )
165+
166+
167+ def test_my_trades_with_marketid (api , api_query_mock ):
168+ """ If a marketid is provided, it should call mytrades. """
169+ api .my_trades (marketid = 10 )
170+ api_query_mock .assert_called_with ('mytrades' ,
171+ request_data = {
172+ 'marketid' : 10 ,
173+ 'limit' : 200
174+ })
175+
176+
177+ def test_my_trades_with_marketid_and_limit (api , api_query_mock ):
178+ """ If limit is provided, use it.. """
179+ api .my_trades (marketid = 10 , limit = 10 )
180+ api_query_mock .assert_called_with ('mytrades' ,
181+ request_data = {
182+ 'marketid' : 10 ,
183+ 'limit' : 10
184+ })
185+
186+
187+ def test_my_orders_no_marketid (api , api_query_mock ):
188+ """ If no marketid is provided, it should call allmyorders. """
189+ api .my_orders ()
190+ api_query_mock .assert_called_with ('allmyorders' )
191+
192+
193+ def test_my_orders_with_marketid (api , api_query_mock ):
194+ """ If a marketid is provided, it should call myorders. """
195+ api .my_orders (marketid = 10 )
196+ api_query_mock .assert_called_with ('myorders' ,
197+ request_data = {
198+ 'marketid' : 10 ,
199+ })
200+
201+
202+ def test_depth (api , api_query_mock ):
203+ """ Should call depth with given marketid. """
204+ api .depth (marketid = 10 )
205+ api_query_mock .assert_called_with ('depth' , request_data = {'marketid' : 10 })
206+
207+
208+ def test_cancel_order (api , api_query_mock ):
209+ """ Should call cancelorders with given orderid. """
210+ api .cancel_order (orderid = 10 )
211+ api_query_mock .assert_called_with ('cancelorder' ,
212+ request_data = {'orderid' : 10 })
213+
214+
215+ def test_cancel_all_market_orders (api , api_query_mock ):
216+ """ Should call cancelmarketorders with given marketid. """
217+ api .cancel_all_market_orders (marketid = 10 )
218+ api_query_mock .assert_called_with ('cancelmarketorders' ,
219+ request_data = {'marketid' : 10 })
220+
221+
222+ def test_cancel_all_orders (api , api_query_mock ):
223+ """ Should call cancelallorders. """
224+ api .cancel_all_orders ()
225+ api_query_mock .assert_called_with ('cancelallorders' )
226+
227+
228+ def test_calculate_fees (api , api_query_mock ):
229+ """ Should call calculatefees with the correct parameters. """
230+ api .calculate_fees ('Buy' , 200 , 10 )
231+ api_query_mock .assert_called_with ('calculatefees' ,
232+ request_data = {
233+ 'ordertype' : 'Buy' ,
234+ 'quantity' : 200 ,
235+ 'price' : 10
236+ })
237+
238+ def test_my_transfers (api , api_query_mock ):
239+ """ Should call mytransfers. """
240+ api .my_transfers ()
241+ api_query_mock .assert_called_with ('mytransfers' )
242+
243+
244+ def test_wallet_status (api , api_query_mock ):
245+ """ Should call getwalletstatus. """
246+ api .wallet_status ()
247+ api_query_mock .assert_called_with ('getwalletstatus' )
248+
249+
250+ def test_make_withdrawal (api , api_query_mock ):
251+ """ Should call makewithdrawal with the given parameters. """
252+ api .make_withdrawal ('address' , 100 )
253+ api_query_mock .assert_called_with ('makewithdrawal' ,
254+ request_data = {
255+ 'address' : 'address' ,
256+ 'amount' : 100
257+ })
0 commit comments