fixes
This commit is contained in:
@@ -2,6 +2,7 @@ import unittest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from proxy import proxy_app
|
||||
|
||||
|
||||
class FlaskTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
@@ -28,7 +29,7 @@ class FlaskTestCase(unittest.TestCase):
|
||||
|
||||
response = self.app.get('/proxy?url=https://example.com/rss.xml')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b'<?xml version="1.0" encoding="UTF-8"?>', response.data) # Проверка перекодировки
|
||||
self.assertIn(b'<?xml version="1.0" encoding="UTF-8"?>', response.data)
|
||||
|
||||
@patch("proxy.rss_proxy.requests.get")
|
||||
def test_proxy_missing_url(self, mock_get):
|
||||
@@ -46,5 +47,6 @@ class FlaskTestCase(unittest.TestCase):
|
||||
self.assertEqual(response.status_code, 500)
|
||||
self.assertIn(b'Error: Request failed', response.data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user