MockWriter
Mock Writer functionality for Tests integration.
Mock writer for testing purposes.
This module provides a mock implementation of LogWriter that captures logs in memory for testing purposes.
MockLogWriter
Mock implementation of LogWriter for testing.
This class captures all logs and commands in memory, allowing tests to verify what was logged without making actual API calls.
__init__
Initialize a MockLogWriter instance.
Arguments:
Name | Description |
---|---|
config | Configuration for the LogWriter. |
repository_id
Get the repository ID.
commit
Mock commit that stores the log instead of queuing it.
Arguments:
Name | Description |
---|---|
log | CommitLog object to store. |
flush
Mock flush that moves queued logs to flushed logs.
Arguments:
Name | Description |
---|---|
is_sync | Whether to flush synchronously (ignored in mock). |
flush_commit_logs
Mock flush for commit logs only.
flush_upload_attachment_logs
Mock flush for upload attachment logs only.
cleanup
Mock cleanup that flushes remaining logs.
Arguments:
Name | Description |
---|---|
is_sync | Whether to cleanup synchronously (ignored in mock). |
get_all_logs
Get all logs (committed, flushed, and uploaded).
get_committed_logs
Get only committed logs.
get_flushed_logs
Get only flushed logs.
get_uploaded_attachments
Get only uploaded attachment logs.
get_logs_by_action
Get logs filtered by action type.
get_logs_by_entity_action
Get logs filtered by entity and action type.
get_logs_by_entity
Get logs filtered by entity type.
get_logs_by_entity_and_action
Get logs filtered by entity and action type.
get_logs_by_entity_id
Get logs filtered by entity ID.
clear_logs
Clear all stored logs.
assert_log_count
Assert the total number of logs.
assert_entity_action_count
Assert the number of logs for a specific entity and action.
assert_action_count
Assert the number of logs for a specific action.
assert_entity_count
Assert the number of logs for a specific entity.
print_logs_summary
Print a summary of all captured logs for debugging.