Skip to content

Commit 408aace

Browse files
committed
Fix PR review feedback: restore test assertions and simplify ActionQueue settings storage
- Add missing pytest.raises assertions for Nexity auth tests that were silently passing without verifying exception behavior - Store ActionQueueSettings directly instead of unpacking into separate fields
1 parent 719119d commit 408aace

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

pyoverkiz/action_queue.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ def __init__(
9696
:param settings: Queue configuration (uses defaults if None)
9797
"""
9898
self._executor = executor
99-
settings = settings or ActionQueueSettings()
100-
self._delay = settings.delay
101-
self._max_actions = settings.max_actions
99+
self._settings = settings or ActionQueueSettings()
102100

103101
self._pending_actions: list[Action] = []
104102
self._pending_mode: ExecutionMode | None = None
@@ -187,7 +185,7 @@ async def add(
187185
self._pending_waiters.append(waiter)
188186

189187
# If we hit max actions, flush immediately
190-
if len(self._pending_actions) >= self._max_actions:
188+
if len(self._pending_actions) >= self._settings.max_actions:
191189
# Prepare the current batch for flushing (which includes the actions
192190
# we just added). If we already flushed due to mode change, this is
193191
# a second batch.
@@ -207,7 +205,7 @@ async def _delayed_flush(self) -> None:
207205
"""Wait for the delay period, then flush the queue."""
208206
waiters: list[QueuedExecution] = []
209207
try:
210-
await asyncio.sleep(self._delay)
208+
await asyncio.sleep(self._settings.delay)
211209
async with self._lock:
212210
if not self._pending_actions:
213211
return

tests/test_auth.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
_decode_jwt_payload,
3838
)
3939
from pyoverkiz.enums import APIType, Server
40-
from pyoverkiz.exceptions import InvalidTokenError
40+
from pyoverkiz.exceptions import InvalidTokenError, NexityBadCredentialsError
4141
from pyoverkiz.models import ServerConfig
4242

4343

@@ -523,7 +523,8 @@ async def test_login_maps_invalid_credentials_client_error(self):
523523
patch("warrant_lite.WarrantLite", return_value=warrant_instance),
524524
):
525525
strategy = NexityAuthStrategy(credentials, session, server_config, True)
526-
await strategy.login()
526+
with pytest.raises(NexityBadCredentialsError):
527+
await strategy.login()
527528

528529
@pytest.mark.asyncio
529530
async def test_login_propagates_non_auth_client_error(self):
@@ -550,7 +551,8 @@ async def test_login_propagates_non_auth_client_error(self):
550551
patch("warrant_lite.WarrantLite", return_value=warrant_instance),
551552
):
552553
strategy = NexityAuthStrategy(credentials, session, server_config, True)
553-
await strategy.login()
554+
with pytest.raises(ClientError, match="InternalErrorException"):
555+
await strategy.login()
554556

555557

556558
class TestRexelAuthStrategy:

0 commit comments

Comments
 (0)