From d4b838700077f4252a1fb4d05aef3fbfdfd45273 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Wed, 25 Jan 2023 16:35:55 +0545 Subject: [PATCH] removed step implementation for copying zip file from tmp folder to sync root --- test/gui/shared/steps/file_context.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/test/gui/shared/steps/file_context.py b/test/gui/shared/steps/file_context.py index 29a468f2f73..44115d85627 100644 --- a/test/gui/shared/steps/file_context.py +++ b/test/gui/shared/steps/file_context.py @@ -75,7 +75,6 @@ def waitAndTryToWriteFile(resource, content): def zipFilesAndfolders(filesAndFolders, path, zipFileName): - print(filesAndFolders[1:]) with zipfile.ZipFile(join(path, zipFileName), 'w') as zippedFile: for file in filesAndFolders[1:]: os.chdir('/tmp') @@ -276,8 +275,8 @@ def step(context, username, foldername): regexp=True, ) def step(context, username, resourceType, resourceName): - source_dir = join(context.userData['tempFolderPath'], resourceName) - destination_dir = getResourcePath(context, '/', username) + source_dir = join(get_config('tempFolderPath'), resourceName) + destination_dir = getResourcePath( '/', username) shutil.move(source_dir, destination_dir) @@ -295,7 +294,7 @@ def step(context, username, resourceType, source, destination): @Given('the user has created a zip file "|any|" with following folders and files') def step(context, zipFileName): - path = context.userData['tempFolderPath'] + path = get_config('tempFolderPath') for content in context.table[1:]: if content[1] == 'folder': folder = join(path, content[0]) @@ -307,17 +306,8 @@ def step(context, zipFileName): zipFilesAndfolders(context.table, path, zipFileName) -@Given('the user "|any|" copies the zip file "|any|" into the sync root') -def step(context, username, zipFileName): - path = context.userData['tempFolderPath'] - source_dir = join(path, zipFileName) - syncPath = getUserSyncPath(context, username) - destination_dir = join(syncPath, zipFileName) - shutil.copyfile(source_dir, destination_dir) - - @When('the user "|any|" unzips the zip file "|any|" inside the sync root') def step(context, username, zipFileName): - destination_dir = getResourcePath(context, zipFileName, username) + destination_dir = getResourcePath(zipFileName, username) with ZipFile(destination_dir, 'r') as zObject: - zObject.extractall(path=getResourcePath(context)) + zObject.extractall(path=getResourcePath('/'))