Skip to content

Commit

Permalink
Added test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ManithaSrinivasa committed Nov 18, 2024
1 parent 1a48afb commit 217a927
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
23 changes: 23 additions & 0 deletions test/integration/features/F001_Valid_Change_Events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -513,3 +513,26 @@ Feature: F001. Ensure valid change events are converted and sent to DoS
| " 0123456789" | 0123456789 |
| "0123456789 " | 0123456789 |
| "012 34567 89" | 0123456789 |


@complete @general
Scenario Outline: F001SX40. Changes are processed successfully for service_type = "134" with OrganisationSubType = "DistanceSelling"
Given an entry is created in the services table
And the service "service_type" is set to "134"
And the service "service_status" is set to "1"
And the entry is committed to the services table
And the change event "OrganisationSubType" is set to "DistanceSelling"
When the Changed Event is sent for processing with "valid" api key
Then the "service-sync" lambda shows field "message" with value "Update Request Success"
And the service history is not updated
When the change event "<field>" is set to "<value>"
When the Changed Event is sent for processing with "valid" api key
Then the "<DOS_field>" is updated within the DoS DB
And the service history is updated with the "<field>"
And the service history shows "<service_hist_field>" change type is "modify"

Examples:
| field | value | DOS_field |service_hist_field |
| Postcode | CT1 1AA | Postcode | postalcode |
| website | www.testonetwo.com | website | cmsurl |
| phone | 22459436909 | phone | cmstelephoneno |
4 changes: 2 additions & 2 deletions test/integration/steps/functions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def get_expected_data(context: Context, changed_data_name: str) -> Any:
"""Get the previous data from the context."""
match changed_data_name.lower():
case "phone_no" | "phone" | "public_phone" | "publicphone":
changed_data = context.phone
changed_data = context.generator_data["publicphone"]
case "website" | "web":
changed_data = context.website
changed_data = context.generator_data["web"]
case "address":
changed_data = get_address_string(context)
case "postcode":
Expand Down
15 changes: 15 additions & 0 deletions test/integration/steps/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,21 @@ def change_event_with_blank_opening_times(context: Context) -> Context:
return context


@when(parse('the change event "{field_name}" is set to "{values}"'), target_fixture="context")
def _(field_name: str, values: str, context: Context) -> Context:
"""Update the change event values in the context.
Args:
field_name (str): The field name to update.
values (str): The values to update the field with.
context (Context): The context object.
Returns:
Context: The context object.
"""
return ce_values_updated_in_context(field_name, values, context)


@when(parse('a "{queue_type}" SQS message is added to the queue'), target_fixture="context")
def post_an_sqs_message(queue_type: str, context: Context) -> None:
"""Post an SQS message to the queue.
Expand Down

0 comments on commit 217a927

Please sign in to comment.