From a622eca7202b04f90e5ceaa34dcda8029afddfe9 Mon Sep 17 00:00:00 2001 From: Alan Christie Date: Sat, 11 Jan 2025 08:22:22 +0000 Subject: [PATCH] style: Better steps and more logic when not logged-in --- .../features/public-target-loader.feature | 5 +-- .../squonk2-basic-job-execution.feature | 23 ++++++++------ behaviour/features/steps/steps.py | 31 ++++++++++++------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/behaviour/features/public-target-loader.feature b/behaviour/features/public-target-loader.feature index dbfadd9..fb2b43f 100644 --- a/behaviour/features/public-target-loader.feature +++ b/behaviour/features/public-target-loader.feature @@ -28,10 +28,11 @@ Feature: Verify good Targets can be loaded against the public TAS We introduce a timeout to allow for the upload to complete, which is typically twice the expected processing time (after upload). - Given I can login + Given I do not login And I can access the "fragalysis-stack-xchem-data" bucket When I get the TGZ encoded file from the bucket - And load it against target access string "lb18145-1" + And I login + And I load the file against target access string "lb18145-1" Then the response should be ACCEPTED And the response should contain a task status endpoint And the task status should have a value of SUCCESS within minutes diff --git a/behaviour/features/squonk2-basic-job-execution.feature b/behaviour/features/squonk2-basic-job-execution.feature index 50f195b..1e66207 100644 --- a/behaviour/features/squonk2-basic-job-execution.feature +++ b/behaviour/features/squonk2-basic-job-execution.feature @@ -15,30 +15,33 @@ Feature: Verify a fragalysis stack can run Squonk Jobs against public Targets @wip Scenario: Load A71EV2A Target data against lb18145-1 - Given I can login + Given I do not login And I can access the "fragalysis-stack-xchem-data" bucket When I get the TGZ encoded file lb32627-66_v2.2_upload_1_2024-12_09 from the bucket - And load it against target access string "lb18145-1" + And I login + And I load the file against target access string "lb18145-1" Then the response should be ACCEPTED And the response should contain a task status endpoint And the task status should have a value of SUCCESS within 6 minutes @wip Scenario: Create a SessionProject and Snapshot for A71EV2A - Given I can login - And can get the "A71EV2A" Target ID - When I create a new SessionProject with the title "Behaviour SessionProject" + Given I do not login + And I can get the "A71EV2A" Target ID + When I login + And I create a new SessionProject with the title "Behaviour SessionProject" Then the response should be CREATED When I create a new Snapshot with the title "Behaviour Snapshot" Then the response should be CREATED @wip Scenario: Transfer A71EV2A Snapshot files to Squonk - Given I can login - And can get the "lb18145-1" Project ID - And can get the "A71EV2A" Target ID - And can get the "Behaviour SessionProject" SessionProject ID - And can get the "Behaviour Snapshot" Snapshot ID + Given I do not login + And I can get the "lb18145-1" Project ID + And I can get the "A71EV2A" Target ID + And I can get the "Behaviour SessionProject" SessionProject ID + And I can get the "Behaviour Snapshot" Snapshot ID + When I login When I transfer the following files to Squonk """ { diff --git a/behaviour/features/steps/steps.py b/behaviour/features/steps/steps.py index 4ad3285..edff782 100644 --- a/behaviour/features/steps/steps.py +++ b/behaviour/features/steps/steps.py @@ -14,7 +14,11 @@ # # 2. Step string variables should normally be enclosed in double quotes, # i.e. "this is a string". This applies to the target access string -# and any _naturel_ string like a title. Certainly anything that can contain spaces! +# and any _natural_ string like a title, e.g.: - +# +# And I can get the "A71EV2A" Target ID +# +# Certainly this applies anything that can contain spaces! import ast import http @@ -100,7 +104,8 @@ def an_empty_stack_using_the_image_tag_x(context, image_tag) -> None: @given("I can login") # pylint: disable=not-callable -def i_can_login(context) -> None: +@when("I login") # pylint: disable=not-callable +def do_login(context) -> None: """Sets the context members: - - stack_name - session_id""" @@ -130,8 +135,8 @@ def i_can_access_the_x_bucket(context, bucket_name) -> None: context.bucket_name = bucket_name -@given('can get the "{title}" Target ID') # pylint: disable=not-callable -def can_get_the_x_target_id(context, title) -> None: +@given('I can get the "{title}" Target ID') # pylint: disable=not-callable +def i_can_get_the_x_target_id(context, title) -> None: """Checks a Target exists and records its ID and relies on the context members: - - session_id - stack_name @@ -154,8 +159,8 @@ def can_get_the_x_target_id(context, title) -> None: context.target_id = target_id -@given('can get the "{title}" Project ID') # pylint: disable=not-callable -def can_get_the_x_project_id(context, title) -> None: +@given('I can get the "{title}" Project ID') # pylint: disable=not-callable +def i_can_get_the_x_project_id(context, title) -> None: """Checks a Project exists and records its ID and relies on the context members: - - session_id - stack_name @@ -178,8 +183,8 @@ def can_get_the_x_project_id(context, title) -> None: context.project_id = project_id -@given('can get the "{title}" SessionProject ID') # pylint: disable=not-callable -def can_get_the_x_session_project_id(context, title) -> None: +@given('I can get the "{title}" SessionProject ID') # pylint: disable=not-callable +def i_can_get_the_x_session_project_id(context, title) -> None: """Checks a SessionProject exists and records its ID relying on the context members: - - session_id - stack_name @@ -203,8 +208,8 @@ def can_get_the_x_session_project_id(context, title) -> None: context.session_project_id = session_project_id -@given('can get the "{title}" Snapshot ID') # pylint: disable=not-callable -def can_get_the_x_snapshot_id(context, title) -> None: +@given('I can get the "{title}" Snapshot ID') # pylint: disable=not-callable +def i_can_get_the_x_snapshot_id(context, title) -> None: """Checks a Snapshot exists and records its ID relying on the context members: - - session_id - stack_name @@ -400,8 +405,10 @@ def i_get_the_x_encoded_file_y_from_the_bucket(context, ext, bucket_object) -> N context.target_file = target_file -@when('load it against target access string "{tas}"') # pylint: disable=not-callable -def load_it_against_target_access_string_x(context, tas) -> None: +@when( # pylint: disable=not-callable + 'I load the file against target access string "{tas}"' +) +def i_load_the_file_against_target_access_string_x(context, tas) -> None: """Loads a previously downloaded file into the stack using the given TAS. Relies on context members: - - target_file