Skip to content

Commit 088cf14

Browse files
committed
add test coverage for copying virtual file inside a folder
1 parent 04eda65 commit 088cf14

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

test/gui/shared/steps/file_context.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ def step(context, username, filename, filesize):
121121
createFileWithSize(filename, filesize)
122122

123123

124-
@When('the user copies the folder "|any|" to "|any|"')
125-
def step(context, sourceFolder, destinationFolder):
126-
source_dir = getResourcePath(sourceFolder)
127-
destination_dir = getResourcePath(destinationFolder)
128-
shutil.copytree(source_dir, destination_dir)
124+
@When(r'the user copies the (file|folder) "([^"]*)" to "([^"]*)"', regexp=True)
125+
def step(context, resource_type, source_dir, destination_dir):
126+
source_dir = getResourcePath(source_dir)
127+
destination_dir = getResourcePath(destination_dir)
128+
if resource_type == 'folder':
129+
return shutil.copytree(source_dir, destination_dir)
130+
else:
131+
return shutil.copy2(source_dir, destination_dir)
129132

130133

131134
@When(r'the user renames a (?:file|folder) "([^"]*)" to "([^"]*)"', regexp=True)

test/gui/tst_vfs/test.feature

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Feature: Enable/disable virtual file support
3737
Scenario: Copy and paste virtual file
3838
Given user "Alice" has been created on the server with default attributes and without skeleton files
3939
And user "Alice" has uploaded file with content "test file" to "textfile.txt" in the server
40+
And user "Alice" has uploaded file with content "lorem file" to "lorem.txt" in the server
41+
And user "Alice" has created folder "folder1" in the server
4042
And user "Alice" has set up a client with default settings
4143
When user "Alice" creates a file "localFile.txt" with the following content inside the sync folder
4244
"""
@@ -45,5 +47,10 @@ Feature: Enable/disable virtual file support
4547
And the user waits for the files to sync
4648
Then the file "localFile.txt" should be downloaded
4749
And as "Alice" file "localFile.txt" should exist in the server
50+
And the placeholder of file "lorem.txt" should exist on the file system
51+
And the placeholder of file "textfile.txt" should exist on the file system
4852
When user "Alice" copies file "textfile.txt" to temp folder
53+
And the user copies the file "lorem.txt" to "folder1"
4954
Then the file "textfile.txt" should be downloaded
55+
And the file "folder1/lorem.txt" should be downloaded
56+
And as "Alice" file "folder1/lorem.txt" should exist in the server

0 commit comments

Comments
 (0)