@@ -127,7 +127,7 @@ def test_auto_summary_success(test_data):
127127 # Setup mock responses
128128 mock_vdb_core_instance = MagicMock ()
129129 mock_user_info = ("test_user_id" , "test_tenant_id" , "en" )
130-
130+
131131 # Setup service mock
132132 mock_service_instance = MagicMock ()
133133 mock_service_instance .summary_index_name = AsyncMock ()
@@ -138,7 +138,7 @@ def test_auto_summary_success(test_data):
138138 with patch ('backend.apps.knowledge_summary_app.ElasticSearchService' , return_value = mock_service_instance ), \
139139 patch ('backend.apps.knowledge_summary_app.get_vector_db_core' , return_value = mock_vdb_core_instance ), \
140140 patch ('backend.apps.knowledge_summary_app.get_current_user_info' , return_value = mock_user_info ):
141-
141+
142142 # Execute test with model_id parameter
143143 response = client .post (
144144 f"/summary/{ test_data ['index_name' ]} /auto_summary?batch_size=500&model_id=1" ,
@@ -149,7 +149,7 @@ def test_auto_summary_success(test_data):
149149
150150 # Assertions - verify the function was called exactly once
151151 assert mock_service_instance .summary_index_name .call_count == 1
152-
152+
153153 # Extract the call arguments to verify expected values without comparing object identity
154154 call_kwargs = mock_service_instance .summary_index_name .call_args .kwargs
155155 assert call_kwargs ['index_name' ] == test_data ['index_name' ]
@@ -163,7 +163,7 @@ def test_auto_summary_without_model_id(test_data):
163163 # Setup mock responses
164164 mock_vdb_core_instance = MagicMock ()
165165 mock_user_info = ("test_user_id" , "test_tenant_id" , "en" )
166-
166+
167167 # Setup service mock
168168 mock_service_instance = MagicMock ()
169169 mock_service_instance .summary_index_name = AsyncMock ()
@@ -174,7 +174,7 @@ def test_auto_summary_without_model_id(test_data):
174174 with patch ('backend.apps.knowledge_summary_app.ElasticSearchService' , return_value = mock_service_instance ), \
175175 patch ('backend.apps.knowledge_summary_app.get_vector_db_core' , return_value = mock_vdb_core_instance ), \
176176 patch ('backend.apps.knowledge_summary_app.get_current_user_info' , return_value = mock_user_info ):
177-
177+
178178 # Execute test without model_id parameter
179179 response = client .post (
180180 f"/summary/{ test_data ['index_name' ]} /auto_summary?batch_size=500" ,
@@ -185,7 +185,7 @@ def test_auto_summary_without_model_id(test_data):
185185
186186 # Assertions - verify the function was called exactly once
187187 assert mock_service_instance .summary_index_name .call_count == 1
188-
188+
189189 # Extract the call arguments to verify expected values without comparing object identity
190190 call_kwargs = mock_service_instance .summary_index_name .call_args .kwargs
191191 assert call_kwargs ['index_name' ] == test_data ['index_name' ]
@@ -199,7 +199,7 @@ def test_auto_summary_exception(test_data):
199199 # Setup mock to raise exception
200200 mock_vdb_core_instance = MagicMock ()
201201 mock_user_info = ("test_user_id" , "test_tenant_id" , "en" )
202-
202+
203203 # Setup service mock to raise exception
204204 mock_service_instance = MagicMock ()
205205 mock_service_instance .summary_index_name = AsyncMock (
@@ -210,7 +210,7 @@ def test_auto_summary_exception(test_data):
210210 with patch ('backend.apps.knowledge_summary_app.ElasticSearchService' , return_value = mock_service_instance ), \
211211 patch ('backend.apps.knowledge_summary_app.get_vector_db_core' , return_value = mock_vdb_core_instance ), \
212212 patch ('backend.apps.knowledge_summary_app.get_current_user_info' , return_value = mock_user_info ):
213-
213+
214214 # Execute test
215215 response = client .post (
216216 f"/summary/{ test_data ['index_name' ]} /auto_summary" ,
@@ -243,7 +243,7 @@ def test_change_summary_success(test_data):
243243 # Execute test with direct patching of route handler function
244244 with patch ('backend.apps.knowledge_summary_app.ElasticSearchService' , return_value = mock_service_instance ), \
245245 patch ('backend.apps.knowledge_summary_app.get_current_user_id' , return_value = test_data ["user_id" ]):
246-
246+
247247 response = client .post (
248248 f"/summary/{ test_data ['index_name' ]} /summary" ,
249249 json = request_data ,
@@ -278,7 +278,7 @@ def test_change_summary_exception(test_data):
278278 # Execute test
279279 with patch ('backend.apps.knowledge_summary_app.ElasticSearchService' , return_value = mock_service_instance ), \
280280 patch ('backend.apps.knowledge_summary_app.get_current_user_id' , return_value = test_data ["user_id" ]):
281-
281+
282282 response = client .post (
283283 f"/summary/{ test_data ['index_name' ]} /summary" ,
284284 json = request_data ,
@@ -327,4 +327,4 @@ def test_get_summary_exception(test_data):
327327
328328 # Assertions
329329 assert response .status_code == 500
330- assert "Failed to get knowledge base summary" in response .json ()["detail" ]
330+ assert "Failed to get knowledge base summary" in response .json ()["detail" ]
0 commit comments