def test_cancel_order(self, access_token, secret_key): client = Client(access_token, secret_key) orders = client.get_pending_orders() for order in orders: res = client.cancel_order(order) self.assertEqual(res.result, "success") self.assertEqual(res.error_code, 0)
def test_cancel_order_with_mock(self, mock_request): _ = mock_request client = Client("access_token", "secret_key") orders = client.get_pending_orders() for order in orders: res = client.cancel_order(order) self.assertEqual(res.result, "success") self.assertEqual(res.error_code, 0)
def test_get_pending_orders(self, access_token, secret_key): client = Client(access_token, secret_key) orders = client.get_pending_orders() for order in orders: self.assertIsInstance(order.order_id, str) self.assertIsInstance(order.timestamp, int) self.assertIsInstance(order.type, str) self.assertIsInstance(order.price, float) self.assertIsInstance(order.quantity, float) self.assertIsInstance(order.fee_rate, float) self.assertIsInstance(order.index, int)
def test_get_pending_orders_with_mock(self, mock_request): _ = mock_request client = Client("access_token", "secret_key") orders = client.get_pending_orders() for order in orders: self.assertIsInstance(order.order_id, str) self.assertIsInstance(order.timestamp, int) self.assertIsInstance(order.type, str) self.assertIsInstance(order.price, float) self.assertIsInstance(order.quantity, float) self.assertIsInstance(order.fee_rate, float) self.assertIsInstance(order.index, int)