Files
masto-rss/main.py
aserper c8618ec3b7 Add comprehensive test suite with GitHub Actions CI/CD
- Refactor code into testable bot.py module with MastodonRSSBot class
- Create 20+ unit tests covering core functionality and edge cases
- Create 10+ integration tests for RSS parsing and Mastodon posting
- Add GitHub Actions workflow for automated testing
  - Unit tests on Python 3.10, 3.11, 3.12
  - Integration tests with mocked external services
  - Code quality checks (flake8, black, mypy)
  - Docker build validation
- Configure pytest with 80% minimum coverage requirement
- Add test dependencies in requirements-test.txt
- Update .gitignore to exclude test artifacts
- Add comprehensive TESTING.md documentation
- Add test status badge to README
- Maintain full backward compatibility with existing setup
2025-12-12 23:30:38 -05:00

26 lines
822 B
Python

"""Mastodon RSS Bot - Entry point"""
import os
from bot import MastodonRSSBot
def main():
"""Initialize and run the bot with environment configuration"""
# Load configuration from environment variables
bot = MastodonRSSBot(
client_id=os.environ['MASTODON_CLIENT_ID'],
client_secret=os.environ['MASTODON_CLIENT_SECRET'],
access_token=os.environ['MASTODON_ACCESS_TOKEN'],
instance_url=os.environ['MASTODON_INSTANCE_URL'],
feed_url=os.environ['RSS_FEED_URL'],
toot_visibility=os.environ.get('TOOT_VISIBILITY', 'public'),
check_interval=int(os.environ.get('CHECK_INTERVAL', '300')),
state_file=os.environ.get('PROCESSED_ENTRIES_FILE', '/state/processed_entries.txt')
)
# Start the bot
bot.run()
if __name__ == "__main__":
main()