From 528bb601c52f1fc9c0908dea63566d0aafb56901 Mon Sep 17 00:00:00 2001 From: bacon Date: Mon, 3 Mar 2025 01:51:40 +0300 Subject: [PATCH] changes --- .gitignore | 1 + proxy/tests/test_rss_proxy.py | 22 ---------------------- tests/test_app.py | 24 ++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 22 deletions(-) delete mode 100755 proxy/tests/test_rss_proxy.py create mode 100644 tests/test_app.py diff --git a/.gitignore b/.gitignore index 20b2466..d604329 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /data/ /.idea/ +/.venv/ diff --git a/proxy/tests/test_rss_proxy.py b/proxy/tests/test_rss_proxy.py deleted file mode 100755 index 4235438..0000000 --- a/proxy/tests/test_rss_proxy.py +++ /dev/null @@ -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) diff --git a/tests/test_app.py b/tests/test_app.py new file mode 100644 index 0000000..06d2601 --- /dev/null +++ b/tests/test_app.py @@ -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'