Skip to content

Commit

Permalink
combine when steps into one
Browse files Browse the repository at this point in the history
  • Loading branch information
swoichha committed Oct 1, 2021
1 parent ac269f2 commit c6f1a16
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/gui/shared/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,12 @@ def step(context, errorMsg):
test.compare(str(waitForObjectExists(newAccount.ERROR_LABEL).text), errorMsg)


@When('the user deletes the file "|any|"')
def step(context, fileName):
os.remove(context.userData['clientSyncPathUser1'] + fileName)


@When('the user deletes the folder "|any|"')
def step(context, folderName):
shutil.rmtree(context.userData['clientSyncPathUser1'] + folderName)
@When(r'the user deletes the (file|folder) "([^"]*)"', regexp=True)
def step(context, itemType, resource):
resourcePath = sanitizePath(context.userData['clientSyncPathUser1'] + resource)
if itemType == 'file':
os.remove(resourcePath)
elif itemType == 'folder':
shutil.rmtree(resourcePath)
else:
raise Exception("No such item type for resource")

0 comments on commit c6f1a16

Please sign in to comment.