From 5c497c5d0ec60001c81d49bbf2490349befa82fe Mon Sep 17 00:00:00 2001 From: ishabaral Date: Mon, 14 Oct 2024 12:21:07 +0545 Subject: [PATCH] remove middleware steps --- test/gui/config.sample.ini | 1 - test/gui/shared/scripts/bdd_hooks.py | 27 ------------ .../shared/scripts/helpers/ConfigHelper.py | 4 +- test/gui/shared/steps/server_context.py | 42 ------------------- test/gui/tst_syncing/test.feature | 2 +- 5 files changed, 2 insertions(+), 74 deletions(-) diff --git a/test/gui/config.sample.ini b/test/gui/config.sample.ini index 23dc09f61f7..bfda14b0ada 100644 --- a/test/gui/config.sample.ini +++ b/test/gui/config.sample.ini @@ -1,7 +1,6 @@ [DEFAULT] BACKEND_HOST= SECURE_BACKEND_HOST= -MIDDLEWARE_URL= CLIENT_ROOT_SYNC_PATH= MAX_SYNC_TIMEOUT= MIN_SYNC_TIMEOUT= diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index 588e03b2600..b14ccaaddc7 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -119,19 +119,6 @@ def hook(context): if not os.path.exists(tmp_dir): os.makedirs(tmp_dir) - req = request.Request( - url_join(get_config("middlewareUrl"), "init"), - headers={"Content-Type": "application/json"}, - method="POST", - ) - try: - with request.urlopen(req) as _: - pass - except error.HTTPError as e: - raise ConnectionRefusedError( - "Step execution through test middleware failed. Error: " + e.read().decode() - ) from e - # sync connection folder display name set_config("syncConnectionName", "Personal" if get_config("ocis") else "ownCloud") @@ -183,20 +170,6 @@ def hook(context): elif scenario_failed(): test.log("No coredump found!") - # cleanup test server - req = request.Request( - url_join(get_config("middlewareUrl"), "cleanup"), - headers={"Content-Type": "application/json"}, - method="POST", - ) - try: - with request.urlopen(req) as _: - pass - except error.HTTPError as e: - raise ConnectionRefusedError( - "Step execution through test middleware failed. Error: " + e.read().decode() - ) from e - global PREVIOUS_FAIL_RESULT_COUNT, PREVIOUS_ERROR_RESULT_COUNT PREVIOUS_FAIL_RESULT_COUNT = test.resultCount("fails") PREVIOUS_ERROR_RESULT_COUNT = test.resultCount("errors") diff --git a/test/gui/shared/scripts/helpers/ConfigHelper.py b/test/gui/shared/scripts/helpers/ConfigHelper.py index 34d3be72515..341bc4241dc 100644 --- a/test/gui/shared/scripts/helpers/ConfigHelper.py +++ b/test/gui/shared/scripts/helpers/ConfigHelper.py @@ -69,7 +69,6 @@ def get_default_home_dir(): 'maxSyncTimeout': 'MAX_SYNC_TIMEOUT', 'minSyncTimeout': 'MIN_SYNC_TIMEOUT', 'lowestSyncTimeout': 'LOWEST_SYNC_TIMEOUT', - 'middlewareUrl': 'MIDDLEWARE_URL', 'clientLogFile': 'CLIENT_LOG_FILE', 'clientRootSyncPath': 'CLIENT_ROOT_SYNC_PATH', 'tempFolderPath': 'TEMP_FOLDER_PATH', @@ -93,7 +92,6 @@ def get_default_home_dir(): 'maxSyncTimeout': 60, 'minSyncTimeout': 5, 'lowestSyncTimeout': 1, - 'middlewareUrl': 'http://localhost:3000/', 'clientLogFile': '-', 'clientRootSyncPath': get_client_root_path(), 'tempFolderPath': os.path.join(get_client_root_path(), 'temp'), @@ -147,7 +145,7 @@ def init_config(): for key, value in CONFIG.items(): if key in ('maxSyncTimeout', 'minSyncTimeout'): CONFIG[key] = builtins.int(value) - elif key in ('localBackendUrl', 'middlewareUrl', 'secureLocalBackendUrl'): + elif key in ('localBackendUrl', 'secureLocalBackendUrl'): # make sure there is always one trailing slash CONFIG[key] = value.rstrip('/') + '/' elif key in ( diff --git a/test/gui/shared/steps/server_context.py b/test/gui/shared/steps/server_context.py index 45917fecc1b..958f966daed 100644 --- a/test/gui/shared/steps/server_context.py +++ b/test/gui/shared/steps/server_context.py @@ -9,48 +9,6 @@ from pageObjects.Toolbar import Toolbar -def execute_step_through_middleware(context, step_name): - body = {'step': step_name} - if hasattr(context, 'table'): - body['table'] = context.table - - params = json.dumps(body).encode('utf8') - - req = urllib.request.Request( - url_join(get_config('middlewareUrl'), 'execute'), - data=params, - headers={'Content-Type': 'application/json'}, - method='POST', - ) - try: - with urllib.request.urlopen(req) as _: - pass - except urllib.error.HTTPError as e: - raise RuntimeError( - 'Step execution through test middleware failed. Error: ' + e.read().decode() - ) from e - - -@Given(r'^(.*) on the server (.*)$', regexp=True) -def step(context, step_part_1, step_part_2): - execute_step_through_middleware(context, f'Given {step_part_1} {step_part_2}') - - -@Given(r'^(.*) on the server$', regexp=True) -def step(context, step_part_1): - execute_step_through_middleware(context, f'Given {step_part_1}') - - -@Then(r'^(.*) on the server (.*)$', regexp=True) -def step(context, step_part_1, step_part_2): - execute_step_through_middleware(context, f'Then {step_part_1} {step_part_2}') - - -@Then(r'^(.*) on the server$', regexp=True) -def step(context, step_part_1): - execute_step_through_middleware(context, f'Then {step_part_1}') - - @Given('app "|any|" has been "|any|" in the server') def step(context, app_name, action): oc.setup_app(app_name, action) diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index 76d083e8436..51e52457038 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -335,7 +335,7 @@ Feature: Syncing files Given user "Alice" has created folder "simple-folder" in the server And user "Alice" has uploaded file "testavatar.png" to "simple-folder/testavatar.png" in the server And user "Alice" has uploaded file "testavatar.jpg" to "simple-folder/testavatar.jpg" in the server - And user "Alice" has uploaded file "testavatar.jpeg" to "simple-folder/testavatar.jpeg" on the server + And user "Alice" has uploaded file "testavatar.jpeg" to "simple-folder/testavatar.jpeg" in the server And user "Alice" has uploaded file "testimage.mp3" to "simple-folder/testimage.mp3" in the server And user "Alice" has uploaded file "test_video.mp4" to "simple-folder/test_video.mp4" in the server And user "Alice" has uploaded file "simple.pdf" to "simple-folder/simple.pdf" in the server