@@ -726,72 +726,3 @@ def test_status_end_point(invoke_with_mock_apigw_request):
726726 )
727727 ),
728728 )
729-
730- # Runnable if we go to tests/docker-compose.mock_aws.yml and add ENVIRONMENT=dev
731- # shows that in a non-local environment we can bypass cache
732-
733- # def test_cache_bypass( # noqa: PLR0913
734- # lambda_client: BaseClient, # noqa:ARG001
735- # persisted_person: NHSNumber,
736- # rsv_campaign_config: CampaignConfig,
737- # consumer_to_active_rsv_campaign_mapping: ConsumerMapping, # noqa: ARG001
738- # consumer_id: ConsumerId,
739- # s3_client: BaseClient,
740- # audit_bucket: BucketName,
741- # invoke_with_mock_apigw_request,
742- # lambda_logs: Callable[[], list[str]],
743- # secretsmanager_client: BaseClient, # noqa:ARG001
744- # ):
745- # # Given
746- # invoke_path = f"/patient-check/{persisted_person}"
747- # headers = {
748- # "nhs-login-nhs-number": str(persisted_person),
749- # "x_request_id": "x_request_id",
750- # "x_correlation_id": "x_correlation_id",
751- # "nhsd_end_user_organisation_ods": "nhsd_end_user_organisation_ods",
752- # "nhsd-application-id": "nhsd-application-id",
753- # "NHSE-Product-ID": consumer_id,
754- # }
755- # params = {"includeActions": "Y"}
756- #
757- # objects = s3_client.list_objects_v2(Bucket="test-rules-bucket").get("Contents", [])
758- # assert_that(objects, is_not(equal_to([])))
759- # config_key = objects[0]["Key"]
760- # original = s3_client.get_object(Bucket="test-rules-bucket", Key=config_key)
761- # original_payload = json.loads(original["Body"].read())
762- # print(original_payload)
763- #
764- # # When
765- # response = invoke_with_mock_apigw_request(path=invoke_path, headers=headers, params=params)
766- #
767- # # Then
768- # assert_that(
769- # response,
770- # is_response().with_status_code(HTTPStatus.OK).and_body(is_json_that(has_key("processedSuggestions"))),
771- # )
772- #
773- # original_payload["CampaignConfig"]["Target"] = "RSV_CHANGED_FOR_BYPASS_TEST"
774- # s3_client.put_object(
775- # Bucket="test-rules-bucket",
776- # Key=config_key,
777- # Body=json.dumps(original_payload),
778- # ContentType="application/json",
779- # )
780- #
781- # # Second request without bypass header should still use cached config
782- # response_2 = invoke_with_mock_apigw_request(invoke_path, headers)
783- # assert_that(
784- # response_2,
785- # is_response().with_status_code(HTTPStatus.OK).and_body(is_json_that(has_key("processedSuggestions"))),
786- # )
787- #
788- # # Third request with bypass header should re-read S3 and reflect the change
789- # bypass_headers = {
790- # **headers,
791- # "X-Bypass-Campaign-Config-Cache": "true",
792- # }
793- # response_3 = invoke_with_mock_apigw_request(invoke_path, bypass_headers)
794- # assert_that(
795- # response_3,
796- # is_response().with_status_code(500),
797- # )
0 commit comments