@@ 222-235 (lines=14) @@ | ||
219 | self.assertEqual(history[0].url, base_url) |
|
220 | self.assertTrue(mock_logger.debug.called) |
|
221 | ||
222 | def test_showMyOrders(self, mock_logger, m): |
|
223 | '''Test function showMyOrders.''' |
|
224 | trading_pair = 'btceur' |
|
225 | params = { 'type': 'buy' } |
|
226 | base_url = f'https://api.bitcoin.de/v4/{trading_pair}/orders' |
|
227 | url_args = '?' + urlencode(params) |
|
228 | response = self.sampleData('showMyOrders') |
|
229 | m.get(requests_mock.ANY, json=response, status_code=200) |
|
230 | self.conn.showMyOrders(type=params.get('type'), |
|
231 | trading_pair=trading_pair) |
|
232 | history = m.request_history |
|
233 | self.assertEqual(history[0].method, "GET") |
|
234 | self.assertEqual(history[0].url, base_url + url_args) |
|
235 | self.assertTrue(mock_logger.debug.called) |
|
236 | ||
237 | def test_showMyOrderDetails(self, mock_logger, m): |
|
238 | '''Test function showMyOrderDetails.''' |
|
@@ 283-296 (lines=14) @@ | ||
280 | self.assertEqual(history[0].url, base_url) |
|
281 | self.assertTrue(mock_logger.debug.called) |
|
282 | ||
283 | def test_showMyTrades_with_params(self, mock_logger, m): |
|
284 | '''Test function showMyTrades with parameters.''' |
|
285 | trading_pair = 'btceur' |
|
286 | base_url = f'https://api.bitcoin.de/v4/{trading_pair}/trades' |
|
287 | response = self.sampleData('showMyTrades') |
|
288 | m.get(requests_mock.ANY, json=response, status_code=200) |
|
289 | history = m.request_history |
|
290 | # Test again without trading pair, but parameter |
|
291 | params = {'type': 'buy'} |
|
292 | url_args = '?' + urlencode(params) |
|
293 | self.conn.showMyTrades(type=params['type'], trading_pair=trading_pair) |
|
294 | self.assertEqual(history[0].method, "GET") |
|
295 | self.assertEqual(history[0].url, base_url + url_args) |
|
296 | self.assertTrue(mock_logger.debug.called) |
|
297 | ||
298 | def test_showMyTradeDetails(self, mock_logger, m): |
|
299 | '''Test function showMyTradeDetails.''' |