@@ -228,7 +228,8 @@ def test_insert_filepaths_copy(self):
228
228
qdb .sql_connection .TRN .add (
229
229
"SELECT last_value FROM qiita.filepath_filepath_id_seq" )
230
230
exp_new_id = 1 + qdb .sql_connection .TRN .execute_fetchflatten ()[0 ]
231
- obs = qdb .util .insert_filepaths ([(fp , 1 )], 2 , "raw_data" , copy = True )
231
+ obs = qdb .util .insert_filepaths ([(fp , 1 )], 2 , "raw_data" ,
232
+ move_files = False , copy = True )
232
233
self .assertEqual (obs , [exp_new_id ])
233
234
234
235
# Check that the files have been copied correctly
@@ -247,6 +248,19 @@ def test_insert_filepaths_copy(self):
247
248
exp = [[exp_new_id , exp_fp , 1 , '852952723' , 1 , 5 , 1 ]]
248
249
self .assertEqual (obs , exp )
249
250
251
+ # let's do that again but with move_files = True
252
+ exp_new_id += 1
253
+ obs = qdb .util .insert_filepaths ([(fp , 1 )], 2 , "raw_data" ,
254
+ move_files = True , copy = True )
255
+ self .assertEqual (obs , [exp_new_id ])
256
+
257
+ # Check that the files have been copied correctly
258
+ exp_fp = join (qdb .util .get_db_files_base_dir (), "raw_data" ,
259
+ "2_%s" % basename (fp ))
260
+ self .assertTrue (exists (exp_fp ))
261
+ self .assertTrue (exists (fp ))
262
+ self .files_to_remove .append (exp_fp )
263
+
250
264
qdb .util .purge_filepaths ()
251
265
252
266
def test_insert_filepaths_string (self ):
0 commit comments