@@ -201,13 +201,14 @@ def test_file_upload_file(nc_any):
201201 assert nc_any .files .download ("test_dir_tmp/test_file_upload_file" ) == content
202202
203203
204- def test_file_upload_chunked_v2 (nc_any ):
204+ @pytest .mark .parametrize ("dest_path" , ("test_dir_tmp/test_file_upl_chunk_v2" , "test_dir_tmp/test_file_upl_chunk_v2_ü" ))
205+ def test_file_upload_chunked_v2 (nc_any , dest_path ):
205206 with NamedTemporaryFile () as tmp_file :
206207 tmp_file .seek (7 * 1024 * 1024 )
207208 tmp_file .write (b"\0 " )
208209 tmp_file .flush ()
209- nc_any .files .upload_stream ("test_dir_tmp/test_file_upload_chunked_v2" , tmp_file .name )
210- assert len (nc_any .files .download ("test_dir_tmp/test_file_upload_chunked_v2" )) == 7 * 1024 * 1024 + 1
210+ nc_any .files .upload_stream (dest_path , tmp_file .name )
211+ assert len (nc_any .files .download (dest_path )) == 7 * 1024 * 1024 + 1
211212
212213
213214@pytest .mark .parametrize ("file_name" , ("chunked_zero" , "chunked_zero/" , "chunked_zero//" ))
@@ -288,43 +289,44 @@ def test_favorites(nc_any):
288289 assert not favorites
289290
290291
291- def test_copy_file (nc_any , rand_bytes ):
292- copied_file = nc_any .files .copy ("test_64_bytes.bin" , "test_dir_tmp/test_64_bytes.bin" )
292+ @pytest .mark .parametrize ("dest_path" , ("test_dir_tmp/test_64_bytes.bin" , "test_dir_tmp/test_64_bytes_ü.bin" ))
293+ def test_copy_file (nc_any , rand_bytes , dest_path ):
294+ copied_file = nc_any .files .copy ("test_64_bytes.bin" , dest_path )
293295 assert copied_file .file_id
294296 assert copied_file .is_dir is False
295- assert nc_any .files .download ("test_dir_tmp/test_64_bytes.bin" ) == rand_bytes
297+ assert nc_any .files .download (dest_path ) == rand_bytes
296298 with pytest .raises (NextcloudException ):
297- nc_any .files .copy ("test_64_bytes.bin" , "test_dir_tmp/test_64_bytes.bin" )
298- copied_file = nc_any .files .copy ("test_12345_text.txt" , "test_dir_tmp/test_64_bytes.bin" , overwrite = True )
299+ nc_any .files .copy ("test_64_bytes.bin" , dest_path )
300+ copied_file = nc_any .files .copy ("test_12345_text.txt" , dest_path , overwrite = True )
299301 assert copied_file .file_id
300302 assert copied_file .is_dir is False
301- assert nc_any .files .download ("test_dir_tmp/test_64_bytes.bin" ) == b"12345"
303+ assert nc_any .files .download (dest_path ) == b"12345"
302304
303305
304- def test_move_file (nc_any ):
306+ @pytest .mark .parametrize ("dest_path" , ("test_dir_tmp/dest move test file" , "test_dir_tmp/dest move test file-ä" ))
307+ def test_move_file (nc_any , dest_path ):
305308 src = "test_dir_tmp/src move test file"
306- dest = "test_dir_tmp/dest move test file"
307309 content = b"content of the file"
308310 content2 = b"content of the file-second part"
309311 nc_any .files .upload (src , content = content )
310- nc_any .files .delete (dest , not_fail = True )
311- result = nc_any .files .move (src , dest )
312+ nc_any .files .delete (dest_path , not_fail = True )
313+ result = nc_any .files .move (src , dest_path )
312314 assert result .etag
313315 assert result .file_id
314316 assert result .is_dir is False
315- assert nc_any .files .download (dest ) == content
317+ assert nc_any .files .download (dest_path ) == content
316318 with pytest .raises (NextcloudException ):
317319 nc_any .files .download (src )
318320 nc_any .files .upload (src , content = content2 )
319321 with pytest .raises (NextcloudException ):
320- nc_any .files .move (src , dest )
321- result = nc_any .files .move (src , dest , overwrite = True )
322+ nc_any .files .move (src , dest_path )
323+ result = nc_any .files .move (src , dest_path , overwrite = True )
322324 assert result .etag
323325 assert result .file_id
324326 assert result .is_dir is False
325327 with pytest .raises (NextcloudException ):
326328 nc_any .files .download (src )
327- assert nc_any .files .download (dest ) == content2
329+ assert nc_any .files .download (dest_path ) == content2
328330
329331
330332def test_move_copy_dir (nc_any ):
@@ -515,10 +517,11 @@ def test_fs_node_last_modified_time():
515517 assert fs_node .info .last_modified == datetime (2022 , 4 , 5 , 1 , 2 , 3 )
516518
517519
518- def test_trashbin (nc_any ):
520+ @pytest .mark .parametrize ("file_path" , ("test_dir_tmp/trashbin_test" , "test_dir_tmp/trashbin_test-ä" ))
521+ def test_trashbin (nc_any , file_path ):
519522 r = nc_any .files .trashbin_list ()
520523 assert isinstance (r , list )
521- new_file = nc_any .files .upload ("test_dir_tmp/trashbin_test" , content = b"" )
524+ new_file = nc_any .files .upload (file_path , content = b"" )
522525 nc_any .files .delete (new_file )
523526 # minimum one object now in a trashbin
524527 r = nc_any .files .trashbin_list ()
@@ -528,7 +531,7 @@ def test_trashbin(nc_any):
528531 # no objects should be in trashbin
529532 r = nc_any .files .trashbin_list ()
530533 assert not r
531- new_file = nc_any .files .upload ("test_dir_tmp/trashbin_test" , content = b"" )
534+ new_file = nc_any .files .upload (file_path , content = b"" )
532535 nc_any .files .delete (new_file )
533536 # one object now in a trashbin
534537 r = nc_any .files .trashbin_list ()
@@ -537,7 +540,7 @@ def test_trashbin(nc_any):
537540 i : FsNode = r [0 ]
538541 assert i .info .in_trash is True
539542 assert i .info .trashbin_filename .find ("trashbin_test" ) != - 1
540- assert i .info .trashbin_original_location == "test_dir_tmp/trashbin_test"
543+ assert i .info .trashbin_original_location == file_path
541544 assert isinstance (i .info .trashbin_deletion_time , int )
542545 # restore that object
543546 nc_any .files .trashbin_restore (r [0 ])
@@ -561,13 +564,14 @@ def test_trashbin(nc_any):
561564 assert not r
562565
563566
564- def test_file_versions (nc_any ):
567+ @pytest .mark .parametrize ("dest_path" , ("/test_dir_tmp/file_versions.txt" , "/test_dir_tmp/file_versions-ä.txt" ))
568+ def test_file_versions (nc_any , dest_path ):
565569 if nc_any .check_capabilities ("files.versioning" ):
566570 pytest .skip ("Need 'Versions' App to be enabled." )
567571 for i in (0 , 1 ):
568- nc_any .files .delete ("/test_dir_tmp/file_versions_test.txt" , not_fail = True )
569- nc_any .files .upload ("/test_dir_tmp/file_versions_test.txt" , content = b"22" )
570- new_file = nc_any .files .upload ("/test_dir_tmp/file_versions_test.txt" , content = b"333" )
572+ nc_any .files .delete (dest_path , not_fail = True )
573+ nc_any .files .upload (dest_path , content = b"22" )
574+ new_file = nc_any .files .upload (dest_path , content = b"333" )
571575 if i :
572576 new_file = nc_any .files .by_id (new_file )
573577 versions = nc_any .files .get_versions (new_file )
0 commit comments