@@ -60,33 +60,30 @@ def test_find_success_file_output(self, runner, tmp_path):
6060 }
6161
6262 with patch ("asta.literature.find.AstaPaperFinder" ) as MockFinder :
63- with patch ("asta.literature.find.Path.cwd" , return_value = tmp_path ):
64- mock_instance = MagicMock ()
65- mock_instance .find_papers .return_value = mock_result
66- MockFinder .return_value = mock_instance
63+ mock_instance = MagicMock ()
64+ mock_instance .find_papers .return_value = mock_result
65+ MockFinder .return_value = mock_instance
6766
68- result = runner .invoke (cli , ["literature" , "find" , "test query" ])
67+ output_file = tmp_path / "results.json"
68+ result = runner .invoke (
69+ cli , ["literature" , "find" , "test query" , "-o" , str (output_file )]
70+ )
6971
7072 assert result .exit_code == 0
7173
72- # Verify file was created in default location
73- output_dir = tmp_path / ".asta" / "literature" / "find"
74- assert output_dir .exists ()
75-
76- # Find the created file (should match pattern: YYYY-MM-DD-HH-MM-SS-test-query.json)
77- json_files = list (output_dir .glob ("*-test-query.json" ))
78- assert len (json_files ) == 1
74+ # Verify file was created at specified location
75+ assert output_file .exists ()
7976
8077 # Verify file contents
81- with open (json_files [ 0 ] ) as f :
78+ with open (output_file ) as f :
8279 data = json .load (f )
8380
8481 assert data ["query" ] == "test query"
8582 assert len (data ["results" ]) == 2
8683 assert data ["results" ][0 ]["corpusId" ] == 123
8784 assert data ["results" ][1 ]["corpusId" ] == 456
8885
89- def test_find_timeout_error (self , runner ):
86+ def test_find_timeout_error (self , runner , tmp_path ):
9087 """Test find command with timeout error."""
9188 with patch ("asta.literature.find.AstaPaperFinder" ) as MockFinder :
9289 mock_instance = MagicMock ()
@@ -95,22 +92,28 @@ def test_find_timeout_error(self, runner):
9592 )
9693 MockFinder .return_value = mock_instance
9794
98- result = runner .invoke (cli , ["literature" , "find" , "test query" ])
95+ output_file = tmp_path / "results.json"
96+ result = runner .invoke (
97+ cli , ["literature" , "find" , "test query" , "-o" , str (output_file )]
98+ )
9999
100100 assert result .exit_code == 2
101101
102- def test_find_general_error (self , runner ):
102+ def test_find_general_error (self , runner , tmp_path ):
103103 """Test find command with general error."""
104104 with patch ("asta.literature.find.AstaPaperFinder" ) as MockFinder :
105105 mock_instance = MagicMock ()
106106 mock_instance .find_papers .side_effect = Exception ("API error" )
107107 MockFinder .return_value = mock_instance
108108
109- result = runner .invoke (cli , ["literature" , "find" , "test query" ])
109+ output_file = tmp_path / "results.json"
110+ result = runner .invoke (
111+ cli , ["literature" , "find" , "test query" , "-o" , str (output_file )]
112+ )
110113
111114 assert result .exit_code == 1
112115
113- def test_find_custom_timeout (self , runner ):
116+ def test_find_custom_timeout (self , runner , tmp_path ):
114117 """Test find command with custom timeout."""
115118 mock_result = {
116119 "query" : "test query" ,
@@ -134,16 +137,26 @@ def test_find_custom_timeout(self, runner):
134137 mock_instance .find_papers .return_value = mock_result
135138 MockFinder .return_value = mock_instance
136139
140+ output_file = tmp_path / "results.json"
137141 result = runner .invoke (
138- cli , ["literature" , "find" , "test query" , "--timeout" , "60" ]
142+ cli ,
143+ [
144+ "literature" ,
145+ "find" ,
146+ "test query" ,
147+ "-o" ,
148+ str (output_file ),
149+ "--timeout" ,
150+ "60" ,
151+ ],
139152 )
140153
141154 assert result .exit_code == 0
142155 mock_instance .find_papers .assert_called_once_with (
143156 "test query" , timeout = 60 , save_to_file = None , operation_mode = "infer"
144157 )
145158
146- def test_find_with_mode_option (self , runner ):
159+ def test_find_with_mode_option (self , runner , tmp_path ):
147160 """Test find command with different operation modes."""
148161 mock_result = {
149162 "query" : "test query" ,
@@ -166,9 +179,19 @@ def test_find_with_mode_option(self, runner):
166179 mock_instance .find_papers .return_value = mock_result
167180 MockFinder .return_value = mock_instance
168181
182+ output_file = tmp_path / "results.json"
169183 # Test fast mode
170184 result = runner .invoke (
171- cli , ["literature" , "find" , "test query" , "--mode" , "fast" ]
185+ cli ,
186+ [
187+ "literature" ,
188+ "find" ,
189+ "test query" ,
190+ "-o" ,
191+ str (output_file ),
192+ "--mode" ,
193+ "fast" ,
194+ ],
172195 )
173196
174197 assert result .exit_code == 0
@@ -413,11 +436,10 @@ def test_documents_config(self):
413436
414437 # Should have required fields
415438 assert config ["tool_name" ] == "asta-documents"
416- assert "install_type" in config
417- assert config ["install_type " ] in ( "pypi" , "git" , "local" )
418- assert "minimum_version" in config
439+ assert config [ "install_type" ] == "pypi"
440+ assert config ["install_source " ] == "asta-resource-repository"
441+ assert config [ "minimum_version" ] == "0.3.0"
419442 assert validate_semver (config ["minimum_version" ])
420- assert "install_source" in config
421443 assert config ["command_name" ] == "documents"
422444
423445 def test_documents_help_requires_installation (self , runner ):
0 commit comments