diff --git a/test_output/test.csv b/test_output/test.csv new file mode 100644 index 0000000..10f5336 --- /dev/null +++ b/test_output/test.csv @@ -0,0 +1,4 @@ +name,age,city +John,30,New York +Anna,22,London +Mike,32,San Francisco diff --git a/tests/test_app.py b/tests/test_app.py index edc080a..2a31e87 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -23,6 +23,7 @@ from bson import ObjectId from tests.test_forum import TestForum from tests.test_dashboard import TestDashboard +import json, os, csv class FlaskAppTests(unittest.TestCase): """ @@ -115,6 +116,57 @@ def test_home_page(self): response = self.client.get('/home') self.assertEqual(response.status_code, 200) self.assertIn(b"Home", response.data) + @patch('app.routes.query_gemini_model') + def test_get_gemini_response(self, mock_query_gemini_model): + """Test get_gemini_response route.""" + mock_query_gemini_model.return_value = ("AI response", "12345") + data = {'message': 'Tell me about job reviews'} + response = self.client.post('/get_gemini_response', data=json.dumps(data), content_type='application/json') + self.assertEqual(response.status_code, 200) + response_data = json.loads(response.data) + self.assertIn('AI response', response_data['ai_message']) + self.assertIn('Click