Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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)