|
11 | 11 |
|
12 | 12 | import pytest |
13 | 13 |
|
| 14 | +from kraken.exceptions import KrakenPermissionDeniedError |
14 | 15 | from kraken.spot import Market, SpotClient, Trade |
15 | 16 |
|
16 | 17 |
|
@@ -63,29 +64,30 @@ def test_create_order_trade_client( |
63 | 64 | self: Self, |
64 | 65 | xstocks_trade_client: Trade, |
65 | 66 | ) -> None: |
66 | | - """ |
67 | | - Checks if the response of the ``create_order`` is of type dict which |
68 | | - mean that the request was successful. |
69 | | - """ |
70 | | - result = xstocks_trade_client.create_order( |
71 | | - **self.SAVE_ORDER, |
72 | | - side="buy", |
73 | | - extra_params={"asset_class": "tokenized_asset"}, |
74 | | - ) |
75 | | - assert "AAPLxUSD" in result.get("descr", {}).get("order", "") |
| 67 | + """Checks if the endpoint is basically available.""" |
| 68 | + with pytest.raises( |
| 69 | + KrakenPermissionDeniedError, |
| 70 | + match=r".*API key doesn't have permission to make this request.*", |
| 71 | + ): |
| 72 | + xstocks_trade_client.create_order( |
| 73 | + **self.SAVE_ORDER, |
| 74 | + side="buy", |
| 75 | + extra_params={"asset_class": "tokenized_asset"}, |
| 76 | + ) |
76 | 77 |
|
77 | 78 | @pytest.mark.spot_auth |
78 | 79 | def test_create_order_spot_client( |
79 | 80 | self: Self, |
80 | 81 | xstocks_client: SpotClient, |
81 | 82 | ) -> None: |
82 | | - """ |
83 | | - Checks if the response of the ``create_order`` is of type dict which |
84 | | - mean that the request was successful. |
85 | | - """ |
86 | | - result = xstocks_client.request( |
87 | | - "POST", |
88 | | - "/0/private/AddOrder", |
89 | | - params={"type": "buy", "asset_class": "tokenized_asset"} | self.SAVE_ORDER, |
90 | | - ) |
91 | | - assert "AAPLxUSD" in result.get("descr", {}).get("order", "") |
| 83 | + """Checks if the endpoint is basically available.""" |
| 84 | + with pytest.raises( |
| 85 | + KrakenPermissionDeniedError, |
| 86 | + match=r".*API key doesn't have permission to make this request.*", |
| 87 | + ): |
| 88 | + xstocks_client.request( |
| 89 | + "POST", |
| 90 | + "/0/private/AddOrder", |
| 91 | + params={"type": "buy", "asset_class": "tokenized_asset"} |
| 92 | + | self.SAVE_ORDER, |
| 93 | + ) |
0 commit comments