Files
rss-proxy/tests/test_app.py
2025-03-03 01:51:40 +03:00

25 lines
751 B
Python

import unittest
from proxy import app
class FlaskTestCase(unittest.TestCase):
def setUp(self):
"""Set up for tests: create a test client."""
self.app = app.test_client()
self.app.testing = True
def test_health_check(self):
"""Check health endpoint."""
response = self.app.get('/health')
self.assertEqual(response.status_code, 200)
self.assertIn(b'healthy', response.data)
def test_proxy(self):
"""Test RSS proxying."""
# Sample URL for proxying
url = 'http://example.com/rss'
response = self.app.get(f'/proxy?url={url}')
self.assertEqual(response.status_code, 200)
self.assertIn(b'<?xml', response.data) # Check for XML response