function test_mixed_mode_dry_run
Asynchronous test function that validates mixed mode initialization by testing reMarkable Cloud authentication and OneDrive configuration without processing any files.
/tf/active/vicechatdev/e-ink-llm/test_mixed_mode.py
121 - 174
moderate
Purpose
This function serves as a dry-run test to verify that a mixed cloud processor can be successfully initialized with both reMarkable Cloud and OneDrive integrations. It checks authentication, configuration files, and the initialization of reMarkable input and gpt_out folder watchers. The test is designed to validate the setup without actually processing any documents, making it safe for pre-deployment verification.
Source Code
async def test_mixed_mode_dry_run():
"""Test mixed mode initialization without processing"""
print("🔄 Testing mixed mode initialization...")
# Test remarkable auth
session = create_remarkable_session()
# Load OneDrive config
config_file = Path("onedrive_config.json")
if not config_file.exists():
print("❌ OneDrive config required for mixed mode test")
return False
with open(config_file, 'r') as f:
onedrive_config = json.load(f)
if not onedrive_config.get('client_id'):
print("❌ OneDrive client_id required for mixed mode test")
return False
try:
# Create mixed processor
mixed_processor = create_mixed_processor(
onedrive_config,
session,
"sk-dummy-api-key-for-testing" # Dummy API key for testing
)
print("✅ Mixed processor created successfully")
# Test initialization of both reMarkable watchers
input_init = await mixed_processor._initialize_remarkable_input_watcher()
gptout_init = await mixed_processor._initialize_remarkable_gptout_watcher()
if input_init:
print("✅ reMarkable input folder watcher initialized")
else:
print("⚠️ reMarkable input folder watcher failed (folder may not exist)")
if gptout_init:
print("✅ reMarkable gpt_out folder watcher initialized")
else:
print("⚠️ reMarkable gpt_out folder watcher failed (folder may not exist)")
if input_init or gptout_init:
print("✅ At least one reMarkable watcher initialized successfully")
return True
else:
print("⚠️ No reMarkable watchers initialized (folders may not exist)")
return False
except Exception as e:
print(f"❌ Mixed mode initialization failed: {e}")
return False
Return Value
Returns a boolean value: True if at least one reMarkable watcher (input or gpt_out) initializes successfully, False if both watchers fail to initialize or if an exception occurs during the process. The function also prints status messages with emoji indicators (✅, ❌, ⚠️) to provide visual feedback about each initialization step.
Dependencies
asyncioargparsejsonsyspathlibmixed_cloud_processoronedrive_clientloggingtraceback
Required Imports
import asyncio
import json
from pathlib import Path
from mixed_cloud_processor import MixedCloudProcessor
from mixed_cloud_processor import create_mixed_processor
from mixed_cloud_processor import create_remarkable_session
Usage Example
import asyncio
import json
from pathlib import Path
from mixed_cloud_processor import create_mixed_processor, create_remarkable_session
# Ensure onedrive_config.json exists with required fields:
# {
# "client_id": "your-client-id",
# "client_secret": "your-secret",
# "tenant_id": "your-tenant-id"
# }
async def main():
result = await test_mixed_mode_dry_run()
if result:
print("Test passed: Mixed mode is properly configured")
else:
print("Test failed: Check configuration and folder setup")
if __name__ == "__main__":
asyncio.run(main())
Best Practices
- This is a test function and should be run in a test environment before production deployment
- Ensure onedrive_config.json exists and contains valid credentials before running
- The function uses a dummy API key ('sk-dummy-api-key-for-testing') which is acceptable for initialization testing but not for actual processing
- The function gracefully handles missing folders with warning messages rather than failing completely
- Always run this test with proper reMarkable Cloud authentication configured
- Monitor the console output for emoji indicators to quickly identify which components initialized successfully
- The function returns False if configuration files are missing, so check return value before proceeding with actual processing
- This test does not process any files, making it safe to run repeatedly without side effects
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function main_v103 79.6% similar
-
function main_v58 74.6% similar
-
function test_remarkable_authentication 73.3% similar
-
function test_remarkable_auth 71.5% similar
-
function test_remarkable_discovery 69.4% similar