changes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/data/
|
/data/
|
||||||
/.idea/
|
/.idea/
|
||||||
|
/.venv/
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import unittest
|
|
||||||
from proxy import app
|
|
||||||
|
|
||||||
|
|
||||||
class FlaskTestCase(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.app = app.test_client()
|
|
||||||
self.app.testing = True
|
|
||||||
|
|
||||||
def test_healthcheck(self):
|
|
||||||
response = self.app.get('/health')
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
def test_proxy_missing_url(self):
|
|
||||||
response = self.app.get('/proxy')
|
|
||||||
self.assertEqual(response.status_code, 400)
|
|
||||||
|
|
||||||
def test_proxy_with_url(self):
|
|
||||||
test_url = 'https://tapochek.net/rss/rssdg.xml'
|
|
||||||
response = self.app.get(f'/proxy?url={test_url}')
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
self.assertTrue(response.data)
|
|
||||||
24
tests/test_app.py
Normal file
24
tests/test_app.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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
|
||||||
Reference in New Issue
Block a user