-
Notifications
You must be signed in to change notification settings - Fork 0
Added some basic tests #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |||||
| from meshcore_api.database.models import Base | ||||||
| from meshcore_api.meshcore.mock import MockMeshCore | ||||||
| from meshcore_api.queue.manager import CommandQueueManager | ||||||
| from meshcore_api.queue.models import QueueFullBehavior | ||||||
| from meshcore_api.subscriber.event_handler import EventHandler | ||||||
| from meshcore_api.webhook.handler import WebhookHandler | ||||||
|
|
||||||
|
|
@@ -74,7 +75,7 @@ def test_config(temp_db_path: str) -> Config: | |||||
| webhook_advertisement_jsonpath="$", | ||||||
| # Queue | ||||||
| queue_max_size=100, | ||||||
| queue_full_behavior="reject", | ||||||
| queue_full_behavior=QueueFullBehavior.REJECT, | ||||||
| # Rate limiting (disabled for fast tests) | ||||||
| rate_limit_enabled=False, | ||||||
| rate_limit_per_second=10.0, | ||||||
|
|
@@ -100,7 +101,7 @@ def test_config_with_auth(test_config: Config) -> Config: | |||||
| def db_engine(test_config: Config) -> Generator[DatabaseEngine, None, None]: | ||||||
| """Create a database engine for testing.""" | ||||||
| engine = DatabaseEngine(test_config.db_path) | ||||||
| engine.init_db() | ||||||
| engine.initialize() | ||||||
| yield engine | ||||||
| engine.close() | ||||||
|
|
||||||
|
|
@@ -135,7 +136,15 @@ async def queue_manager( | |||||
| """Create a CommandQueueManager for testing.""" | ||||||
| manager = CommandQueueManager( | ||||||
| meshcore=mock_meshcore, | ||||||
| config=test_config, | ||||||
| max_queue_size=test_config.queue_max_size, | ||||||
| queue_full_behavior=test_config.queue_full_behavior, | ||||||
|
||||||
| queue_full_behavior=test_config.queue_full_behavior, | |
| queue_full_behavior=QueueFullBehavior(test_config.queue_full_behavior), |
Copilot
AI
Nov 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type mismatch: CommandQueueManager.__init__ expects debounce_commands to be Optional[set[CommandType]], but this code passes a set of strings. The string values need to be converted to CommandType enum values.
Example fix:
debounce_commands={CommandType(cmd.strip()) for cmd in test_config.debounce_commands.split(",")},This assumes the string values in Config match CommandType enum values ("send_message", "send_channel_message", etc.).
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,195 @@ | ||||
| """Unit tests for configuration module - fixed to match actual implementation.""" | ||||
|
|
||||
| import pytest | ||||
|
||||
| import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import of 'Base' is not used.