@@ -201,13 +201,14 @@ def test_file_upload_file(nc_any):
201
201
assert nc_any .files .download ("test_dir_tmp/test_file_upload_file" ) == content
202
202
203
203
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 ):
205
206
with NamedTemporaryFile () as tmp_file :
206
207
tmp_file .seek (7 * 1024 * 1024 )
207
208
tmp_file .write (b"\0 " )
208
209
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
211
212
212
213
213
214
@pytest .mark .parametrize ("file_name" , ("chunked_zero" , "chunked_zero/" , "chunked_zero//" ))
@@ -288,43 +289,44 @@ def test_favorites(nc_any):
288
289
assert not favorites
289
290
290
291
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 )
293
295
assert copied_file .file_id
294
296
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
296
298
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 )
299
301
assert copied_file .file_id
300
302
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"
302
304
303
305
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 ):
305
308
src = "test_dir_tmp/src move test file"
306
- dest = "test_dir_tmp/dest move test file"
307
309
content = b"content of the file"
308
310
content2 = b"content of the file-second part"
309
311
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 )
312
314
assert result .etag
313
315
assert result .file_id
314
316
assert result .is_dir is False
315
- assert nc_any .files .download (dest ) == content
317
+ assert nc_any .files .download (dest_path ) == content
316
318
with pytest .raises (NextcloudException ):
317
319
nc_any .files .download (src )
318
320
nc_any .files .upload (src , content = content2 )
319
321
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 )
322
324
assert result .etag
323
325
assert result .file_id
324
326
assert result .is_dir is False
325
327
with pytest .raises (NextcloudException ):
326
328
nc_any .files .download (src )
327
- assert nc_any .files .download (dest ) == content2
329
+ assert nc_any .files .download (dest_path ) == content2
328
330
329
331
330
332
def test_move_copy_dir (nc_any ):
@@ -515,10 +517,11 @@ def test_fs_node_last_modified_time():
515
517
assert fs_node .info .last_modified == datetime (2022 , 4 , 5 , 1 , 2 , 3 )
516
518
517
519
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 ):
519
522
r = nc_any .files .trashbin_list ()
520
523
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"" )
522
525
nc_any .files .delete (new_file )
523
526
# minimum one object now in a trashbin
524
527
r = nc_any .files .trashbin_list ()
@@ -528,7 +531,7 @@ def test_trashbin(nc_any):
528
531
# no objects should be in trashbin
529
532
r = nc_any .files .trashbin_list ()
530
533
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"" )
532
535
nc_any .files .delete (new_file )
533
536
# one object now in a trashbin
534
537
r = nc_any .files .trashbin_list ()
@@ -537,7 +540,7 @@ def test_trashbin(nc_any):
537
540
i : FsNode = r [0 ]
538
541
assert i .info .in_trash is True
539
542
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
541
544
assert isinstance (i .info .trashbin_deletion_time , int )
542
545
# restore that object
543
546
nc_any .files .trashbin_restore (r [0 ])
@@ -561,13 +564,14 @@ def test_trashbin(nc_any):
561
564
assert not r
562
565
563
566
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 ):
565
569
if nc_any .check_capabilities ("files.versioning" ):
566
570
pytest .skip ("Need 'Versions' App to be enabled." )
567
571
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" )
571
575
if i :
572
576
new_file = nc_any .files .by_id (new_file )
573
577
versions = nc_any .files .get_versions (new_file )
0 commit comments