Skip to content

Commit

Permalink
removed step implementation for copying zip file from tmp folder to s…
Browse files Browse the repository at this point in the history
…ync root
  • Loading branch information
Salipa-Gurung committed Jan 31, 2023
1 parent e5b517b commit d4b8387
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions test/gui/shared/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)


Expand All @@ -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])
Expand All @@ -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('/'))

0 comments on commit d4b8387

Please sign in to comment.