Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] add test_get_api_key_permissions #2511

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import octobot_trading.personal_data.orders as personal_data_orders
import octobot_trading.util.test_tools.exchanges_test_tools as exchanges_test_tools
import octobot_trading.util.test_tools.exchange_data as exchange_data_import
import trading_backend.enums
import octobot_tentacles_manager.api as tentacles_manager_api
from additional_tests.exchanges_tests import get_authenticated_exchange_manager

Expand Down Expand Up @@ -123,6 +124,17 @@ async def inner_test_get_account_id(self):
with pytest.raises(NotImplementedError):
await self.exchange_manager.exchange.get_account_id()

async def test_get_api_key_permissions(self):
async with self.local_exchange_manager():
await self.inner_test_get_api_key_permissions()

async def inner_test_get_api_key_permissions(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

permissions = await self.exchange_manager.exchange_backend._get_api_key_rights()
assert len(permissions) > 0
assert trading_backend.enums.APIKeyRights.READING in permissions
assert trading_backend.enums.APIKeyRights.SPOT_TRADING in permissions
assert trading_backend.enums.APIKeyRights.FUTURES_TRADING in permissions

async def test_create_and_cancel_limit_orders(self):
async with self.local_exchange_manager():
await self.inner_test_create_and_cancel_limit_orders()
Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_ascendex.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
3 changes: 3 additions & 0 deletions additional_tests/exchanges_tests/test_binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ async def test_get_portfolio_with_market_filter(self):
async def test_get_account_id(self):
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
await super().test_get_api_key_permissions()

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_binance_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ async def test_get_portfolio_with_market_filter(self):
async def test_get_account_id(self):
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_get_empty_linear_and_inverse_positions(self):
await super().test_get_empty_linear_and_inverse_positions()

Expand Down
6 changes: 4 additions & 2 deletions additional_tests/exchanges_tests/test_bingx.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ async def test_get_portfolio_with_market_filter(self):
await super().test_get_portfolio_with_market_filter()

async def test_get_account_id(self):
# pass if not implemented
pass
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
await super().test_get_api_key_permissions()

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()
Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_bitget.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
# KYC needed 8th jan 2024 ccxt 4.2.10
await super().test_create_and_cancel_limit_orders()
Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_bybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_bybit_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_get_empty_linear_and_inverse_positions(self):
await super().test_get_empty_linear_and_inverse_positions()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_coinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_coinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_cryptocom.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_hollaex.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_htx.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
3 changes: 3 additions & 0 deletions additional_tests/exchanges_tests/test_kucoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ async def test_create_and_cancel_limit_orders(self):
async def test_get_account_id(self):
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
await super().test_get_api_key_permissions()

async def test_create_and_fill_market_orders(self):
await super().test_create_and_fill_market_orders()

Expand Down
3 changes: 3 additions & 0 deletions additional_tests/exchanges_tests/test_kucoin_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ async def test_get_portfolio_with_market_filter(self):
async def test_get_account_id(self):
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
await super().test_get_api_key_permissions()

async def test_get_empty_linear_and_inverse_positions(self):
await super().test_get_empty_linear_and_inverse_positions()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_mexc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
3 changes: 3 additions & 0 deletions additional_tests/exchanges_tests/test_okx.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ async def test_create_and_cancel_limit_orders(self):
async def test_get_account_id(self):
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
await super().test_get_api_key_permissions()

async def test_create_and_fill_market_orders(self):
await super().test_create_and_fill_market_orders()

Expand Down
3 changes: 3 additions & 0 deletions additional_tests/exchanges_tests/test_okx_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ async def test_get_portfolio_with_market_filter(self):
async def test_get_account_id(self):
await super().test_get_account_id()

async def test_get_api_key_permissions(self):
await super().test_get_api_key_permissions()

async def test_get_empty_linear_and_inverse_positions(self):
await super().test_get_empty_linear_and_inverse_positions()

Expand Down
4 changes: 4 additions & 0 deletions additional_tests/exchanges_tests/test_phemex.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ async def test_get_account_id(self):
# pass if not implemented
pass

async def test_get_api_key_permissions(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OctoBot-Tentacles-Manager==2.9.9
OctoBot-Services==1.6.10
OctoBot-Backtesting==1.9.7
Async-Channel==2.2.1
trading-backend==1.2.13
trading-backend==1.2.14

## Others
colorlog==6.8.0
Expand Down
Loading