diff options
author | Swikriti Tripathi <41103328+SwikritiT@users.noreply.github.com> | 2021-05-19 12:48:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-19 12:48:58 +0300 |
commit | b62327684fdba90211a9efe29dd98f4c12d8284e (patch) | |
tree | 401d34e1e247691ae44d2985c1350cffe30d0bce /test/gui/shared/scripts | |
parent | e4d0fab991e8719b732ef4c059e8199953b05e33 (diff) |
Implement black tool to reformat code according to python standard (#8636)
Diffstat (limited to 'test/gui/shared/scripts')
-rw-r--r-- | test/gui/shared/scripts/bdd_hooks.py | 49 | ||||
-rw-r--r-- | test/gui/shared/scripts/helpers/SetupClientHelper.py | 9 | ||||
-rw-r--r-- | test/gui/shared/scripts/names.py | 2 | ||||
-rw-r--r-- | test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py | 9 |
4 files changed, 44 insertions, 25 deletions
diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index 62a4e98a0..6191035b6 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -19,42 +19,59 @@ import shutil import urllib.request import os + @OnScenarioStart def hook(context): from configparser import ConfigParser + cfg = ConfigParser() cfg.read('../config.ini') context.userData = { - 'localBackendUrl': os.environ.get('BACKEND_HOST', cfg.get('DEFAULT','BACKEND_HOST')), - 'clientSyncPath': os.environ.get('CLIENT_SYNC_PATH', cfg.get('DEFAULT','CLIENT_SYNC_PATH')), - 'clientSyncTimeout': os.environ.get('CLIENT_SYNC_TIMEOUT', cfg.get('DEFAULT','CLIENT_SYNC_TIMEOUT')), - 'middlewareUrl': os.environ.get('MIDDLEWARE_URL', cfg.get('DEFAULT','MIDDLEWARE_URL')), - 'clientConfigFile': os.environ.get('CLIENT_LOG_FILE', cfg.get('DEFAULT','CLIENT_LOG_FILE')), + 'localBackendUrl': os.environ.get( + 'BACKEND_HOST', cfg.get('DEFAULT', 'BACKEND_HOST') + ), + 'clientSyncPath': os.environ.get( + 'CLIENT_SYNC_PATH', cfg.get('DEFAULT', 'CLIENT_SYNC_PATH') + ), + 'clientSyncTimeout': os.environ.get( + 'CLIENT_SYNC_TIMEOUT', cfg.get('DEFAULT', 'CLIENT_SYNC_TIMEOUT') + ), + 'middlewareUrl': os.environ.get( + 'MIDDLEWARE_URL', cfg.get('DEFAULT', 'MIDDLEWARE_URL') + ), + 'clientConfigFile': os.environ.get( + 'CLIENT_LOG_FILE', cfg.get('DEFAULT', 'CLIENT_LOG_FILE') + ), } if context.userData['localBackendUrl'] == '': - context.userData['localBackendUrl']='https://localhost:9200' + context.userData['localBackendUrl'] = 'https://localhost:9200' if context.userData['clientSyncPath'] == '': - context.userData['clientSyncPath']='/tmp/client-bdd/' + context.userData['clientSyncPath'] = '/tmp/client-bdd/' else: - context.userData['clientSyncPath'] = context.userData['clientSyncPath'].rstrip("/") + "/" # make sure there is always one trailing slash + context.userData['clientSyncPath'] = ( + context.userData['clientSyncPath'].rstrip("/") + "/" + ) # make sure there is always one trailing slash if context.userData['clientSyncTimeout'] == '': - context.userData['clientSyncTimeout']=60 + context.userData['clientSyncTimeout'] = 60 else: - context.userData['clientSyncTimeout']=int(context.userData['clientSyncTimeout']) + context.userData['clientSyncTimeout'] = int( + context.userData['clientSyncTimeout'] + ) if not os.path.exists(context.userData['clientSyncPath']): os.makedirs(context.userData['clientSyncPath']) if context.userData['middlewareUrl'] == '': - context.userData['middlewareUrl']='http://localhost:3000/' + context.userData['middlewareUrl'] = 'http://localhost:3000/' if context.userData['clientConfigFile'] == '': - context.userData['clientConfigFile']='-' - + context.userData['clientConfigFile'] = '-' + req = urllib.request.Request( os.path.join(context.userData['middlewareUrl'], 'init'), - headers={"Content-Type": "application/json"}, method='POST' + headers={"Content-Type": "application/json"}, + method='POST', ) try: urllib.request.urlopen(req) @@ -62,14 +79,14 @@ def hook(context): raise Exception( "Step execution through test middleware failed. Error: " + e.read().decode() ) - + @OnScenarioEnd def hook(context): # Detach (i.e. potentially terminate) all AUTs at the end of a scenario for ctx in applicationContextList(): ctx.detach() - snooze(5) #ToDo wait smarter till the app died + snooze(5) # ToDo wait smarter till the app died # delete local files/folders for filename in os.listdir(context.userData['clientSyncPath']): diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py index d9fb5a95d..7e20adb5e 100644 --- a/test/gui/shared/scripts/helpers/SetupClientHelper.py +++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py @@ -1,9 +1,12 @@ from urllib.parse import urlparse + def substituteInLineCodes(context, value): value = value.replace('%local_server%', context.userData['localBackendUrl']) value = value.replace('%client_sync_path%', context.userData['clientSyncPath']) - value = value.replace('%local_server_hostname%', urlparse(context.userData['localBackendUrl']).netloc) + value = value.replace( + '%local_server_hostname%', urlparse(context.userData['localBackendUrl']).netloc + ) return value @@ -20,7 +23,7 @@ def getClientDetails(context): elif row[0] == 'localfolder': localfolder = row[1] try: - os.makedirs(localfolder, 0o0755) + os.makedirs(localfolder, 0o0755) except: pass - return server, user, password, localfolder
\ No newline at end of file + return server, user, password, localfolder diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py index 71be56773..074a5952b 100644 --- a/test/gui/shared/scripts/names.py +++ b/test/gui/shared/scripts/names.py @@ -107,4 +107,4 @@ oCC_ShareLinkWidget_radio_uploadOnly_QRadioButton = {"container": qt_tabwidget_s oCC_ShareLinkWidget_checkBox_expire_QCheckBox = {"container": qt_tabwidget_stackedwidget_OCC_ShareLinkWidget_OCC_ShareLinkWidget, "name": "checkBox_expire", "type": "QCheckBox", "visible": 1} oCC_ShareLinkWidget_checkBox_expire_QProgressIndicator = {"aboveWidget": oCC_ShareLinkWidget_lineEdit_password_QLineEdit, "container": qt_tabwidget_stackedwidget_OCC_ShareLinkWidget_OCC_ShareLinkWidget, "leftWidget": oCC_ShareLinkWidget_checkBox_expire_QCheckBox, "type": "QProgressIndicator", "unnamed": 1, "visible": 1} oCC_IssuesWidget_tableView_QTableView = {"container": qt_tabwidget_stackedwidget_OCC_IssuesWidget_OCC_IssuesWidget, "name": "_tableView", "type": "QTableView", "visible": 1} -o_tableView_0_1_QModelIndex = {"column": 1, "container": oCC_IssuesWidget_tableView_QTableView, "row": 0, "type": "QModelIndex"}
\ No newline at end of file +o_tableView_0_1_QModelIndex = {"column": 1, "container": oCC_IssuesWidget_tableView_QTableView, "row": 0, "type": "QModelIndex"} diff --git a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py index 41a2905ba..bba29edb3 100644 --- a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py +++ b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py @@ -3,7 +3,7 @@ import squish from helpers.SetupClientHelper import getClientDetails -class AccountConnectionWizard(): +class AccountConnectionWizard: SERVER_ADDRESS_BOX = names.leUrl_OCC_PostfixLineEdit NEXT_BUTTON = names.owncloudWizard_qt_passive_wizardbutton1_QPushButton USERNAME_BOX = names.leUsername_QLineEdit @@ -13,13 +13,12 @@ class AccountConnectionWizard(): CHOOSE_BUTTON = names.qFileDialog_Choose_QPushButton CONNECT_BUTTON = names.owncloudWizard_qt_passive_wizardbutton1_QPushButton - def __init__(self): pass - def addAccount(self, context): - server, user, password, localfolder = getClientDetails(context) - + def addAccount(self, context): + server, user, password, localfolder = getClientDetails(context) + squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX)) squish.type(squish.waitForObject(self.SERVER_ADDRESS_BOX), server) squish.clickButton(squish.waitForObject(self.NEXT_BUTTON)) |