117
tests/test_all_notifications.py
Executable file
117
tests/test_all_notifications.py
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test All Notification Types
|
||||
Shows examples of all different notification formats
|
||||
"""
|
||||
|
||||
import sys
|
||||
import json
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
# Add modules to 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():
|
||||
"""Load configuration from settings.json"""
|
||||
config_path = Path(__file__).parent / 'config' / 'settings.json'
|
||||
with open(config_path, 'r') as f:
|
||||
return json.load(f)
|
||||
|
||||
def main():
|
||||
print("Testing All Pushover Notification Formats...")
|
||||
print("=" * 60)
|
||||
|
||||
# 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,
|
||||
default_priority=0
|
||||
)
|
||||
|
||||
tests = [
|
||||
{
|
||||
'name': 'Single Story',
|
||||
'params': {
|
||||
'platform': 'instagram',
|
||||
'source': 'evalongoria',
|
||||
'content_type': 'story',
|
||||
'count': 1
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'Multiple Stories',
|
||||
'params': {
|
||||
'platform': 'instagram',
|
||||
'source': 'evalongoria',
|
||||
'content_type': 'story',
|
||||
'count': 5
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'Multiple Posts with Search',
|
||||
'params': {
|
||||
'platform': 'instagram',
|
||||
'source': 'beautybyelan',
|
||||
'content_type': 'post',
|
||||
'count': 3,
|
||||
'search_term': '@evalongoria, eva longoria'
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'Multiple Reels',
|
||||
'params': {
|
||||
'platform': 'instagram',
|
||||
'source': 'evalongoria',
|
||||
'content_type': 'reel',
|
||||
'count': 7
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'TikTok Videos',
|
||||
'params': {
|
||||
'platform': 'tiktok',
|
||||
'source': 'evalongoria',
|
||||
'content_type': 'video',
|
||||
'count': 4
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'Forum Images',
|
||||
'params': {
|
||||
'platform': 'forum',
|
||||
'source': 'HQCelebCorner',
|
||||
'content_type': 'image',
|
||||
'count': 42,
|
||||
'search_term': 'Eva Longoria'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
print("\nSending test notifications...\n")
|
||||
|
||||
for i, test in enumerate(tests, 1):
|
||||
print(f"{i}. {test['name']}...", end=' ')
|
||||
success = notifier.notify_download(**test['params'])
|
||||
print("✅" if success else "❌")
|
||||
|
||||
# Small delay between notifications
|
||||
import time
|
||||
time.sleep(1)
|
||||
|
||||
print(f"\n{'=' * 60}")
|
||||
print(f"Final Stats: {notifier.get_stats()}")
|
||||
print(f"\nCheck your Pushover app for {len(tests)} notifications!")
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user