Skip to content

Commit

Permalink
style: Better steps and more logic when not logged-in
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Christie committed Jan 11, 2025
1 parent 1815702 commit a622eca
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
5 changes: 3 additions & 2 deletions behaviour/features/public-target-loader.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tgz> 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 <upload timeout> minutes
Expand Down
23 changes: 13 additions & 10 deletions behaviour/features/squonk2-basic-job-execution.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
{
Expand Down
31 changes: 19 additions & 12 deletions behaviour/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"""
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a622eca

Please sign in to comment.