46
tests/test_forum_notification.py
Normal file
46
tests/test_forum_notification.py
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test forum notification"""
|
||||
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
sys.path.insert(0, str(Path(__file__).parent / 'modules'))
|
||||
|
||||
from modules.pushover_notifier import PushoverNotifier
|
||||
|
||||
def load_config():
|
||||
config_path = Path(__file__).parent / 'config' / 'settings.json'
|
||||
with open(config_path, 'r') as f:
|
||||
return json.load(f)
|
||||
|
||||
# Load config
|
||||
config = load_config()
|
||||
pushover_config = config.get('pushover', {})
|
||||
|
||||
# Create notifier
|
||||
notifier = PushoverNotifier(
|
||||
user_key=pushover_config.get('user_key'),
|
||||
api_token=pushover_config.get('api_token'),
|
||||
enabled=True
|
||||
)
|
||||
|
||||
# Simulate forum download - 12 images from HQCelebCorner
|
||||
downloads = []
|
||||
for i in range(12):
|
||||
downloads.append({
|
||||
'source': 'HQCelebCorner',
|
||||
'content_type': 'image',
|
||||
'filename': None
|
||||
})
|
||||
|
||||
# Send notification
|
||||
success = notifier.notify_batch_download(
|
||||
platform='forum',
|
||||
downloads=downloads,
|
||||
search_term='Eva Longoria'
|
||||
)
|
||||
|
||||
print(f"Forum notification sent: {'✅' if success else '❌'}")
|
||||
print(f"Stats: {notifier.get_stats()}")
|
||||
Reference in New Issue
Block a user