コード例 #1
0
ファイル: test_client.py プロジェクト: stinct9/dydx-python
    def test_cancel_perpetual_order_success(self):
        def additional_matcher(request):
            return 'Bearer ' + CANCEL_PERP_ORDER_SIGNATURE == \
                request.headers['Authorization']

        client = Client(PRIVATE_KEY_1)
        with requests_mock.mock() as rm:
            json_obj = tests.test_json.mock_cancel_order_json
            rm.delete('https://api.dydx.exchange/v2/orders/' + PERP_ORDER_HASH,
                      additional_matcher=additional_matcher,
                      json=json_obj)
            result = client.cancel_perpetual_order(hash=PERP_ORDER_HASH)
            assert result == json_obj
コード例 #2
0
ファイル: test_client.py プロジェクト: stinct9/dydx-python
 def test_cancel_perpetual_order_no_hash_error(self):
     client = Client(PRIVATE_KEY_1)
     with pytest.raises(TypeError) as error:
         client.cancel_perpetual_order()
     assert 'required positional argument: \'hash\'' in str(error.value)