@@ -196,17 +196,6 @@ async def load_image():
196196 image = self .service .load_image .return_value
197197 return {"success" : True , "base64" : "mock_base64_data" , "content_type" : "image/jpeg" }
198198
199- @self .app .get ("/tasks/{task_id}" )
200- @pytest .mark .asyncio
201- async def get_task (task_id : str ):
202- # Simulate getting task information
203- task = self .get_task_info .return_value
204-
205- if not task :
206- raise HTTPException (status_code = 404 , detail = f"Task with ID { task_id } not found" )
207-
208- return task
209-
210199 @self .app .get ("/tasks" )
211200 @pytest .mark .asyncio
212201 async def list_tasks ():
@@ -503,49 +492,6 @@ def test_load_image_failure(self):
503492 self .assertEqual (response .status_code , 404 )
504493 self .assertIn ("Failed to load image" , response .json ()["detail" ])
505494
506- def test_get_task_success (self ):
507- """
508- Test getting task information successfully.
509- Verifies that the endpoint returns the expected task data.
510- """
511- # Set up mock
512- task_data = {
513- "id" : self .task_id ,
514- "task_name" : "process_and_forward" ,
515- "index_name" : self .index_name ,
516- "path_or_url" : self .source ,
517- "status" : "SUCCESS" ,
518- "created_at" : "2023-01-01T12:00:00" ,
519- "updated_at" : "2023-01-01T12:05:00" ,
520- "error" : None
521- }
522- self .get_task_info .return_value = task_data
523-
524- # Execute request
525- response = self .client .get (f"/tasks/{ self .task_id } " )
526-
527- # Assert expectations
528- self .assertEqual (response .status_code , 200 )
529- result = response .json ()
530- self .assertEqual (result ["id" ], self .task_id )
531- self .assertEqual (result ["status" ], "SUCCESS" )
532- self .assertEqual (result ["index_name" ], self .index_name )
533-
534- def test_get_task_not_found (self ):
535- """
536- Test getting non-existent task.
537- Verifies that the endpoint returns an appropriate error response.
538- """
539- # Set up mock to return None (task not found)
540- self .get_task_info .return_value = None
541-
542- # Execute request
543- response = self .client .get ("/tasks/nonexistent-id" )
544-
545- # Assert expectations
546- self .assertEqual (response .status_code , 404 )
547- self .assertIn ("not found" , response .json ()["detail" ])
548-
549495 def test_list_tasks (self ):
550496 """
551497 Test listing all tasks.
0 commit comments