Skip to content

Commit

Permalink
remove middleware steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ishabaral committed Oct 14, 2024
1 parent 0ee7693 commit 5c497c5
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 74 deletions.
1 change: 0 additions & 1 deletion test/gui/config.sample.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[DEFAULT]
BACKEND_HOST=
SECURE_BACKEND_HOST=
MIDDLEWARE_URL=
CLIENT_ROOT_SYNC_PATH=
MAX_SYNC_TIMEOUT=
MIN_SYNC_TIMEOUT=
Expand Down
27 changes: 0 additions & 27 deletions test/gui/shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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")
Expand Down
4 changes: 1 addition & 3 deletions test/gui/shared/scripts/helpers/ConfigHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'),
Expand Down Expand Up @@ -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 (
Expand Down
42 changes: 0 additions & 42 deletions test/gui/shared/steps/server_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c497c5

Please sign in to comment.