@@ -480,6 +480,40 @@ def campaign_config(s3_client: BaseClient, rules_bucket: BucketName) -> Generato
480480 yield campaign
481481 s3_client .delete_object (Bucket = rules_bucket , Key = f"{ campaign .name } .json" )
482482
483+ @pytest .fixture (scope = "class" )
484+ def campaign_config_with_and_rule (s3_client : BaseClient , rules_bucket : BucketName ) -> Generator [CampaignConfig ]:
485+ campaign : CampaignConfig = rule .CampaignConfigFactory .build (
486+ target = "RSV" ,
487+ iterations = [
488+ rule .IterationFactory .build (
489+ iteration_rules = [
490+ rule .PostcodeSuppressionRuleFactory .build (cohort_label = "cohort2" ,),
491+ rule .PersonAgeSuppressionRuleFactory .build (),
492+ ],
493+ iteration_cohorts = [
494+ rule .IterationCohortFactory .build (
495+ cohort_label = "cohort1" ,
496+ cohort_group = "cohort_group1" ,
497+ positive_description = "positive_description" ,
498+ negative_description = "negative_description" ,
499+ ),
500+ rule .IterationCohortFactory .build (
501+ cohort_label = "cohort2" ,
502+ cohort_group = "cohort_group2" ,
503+ positive_description = "positive_description" ,
504+ negative_description = "negative_description" ,
505+ )
506+ ],
507+ )
508+ ],
509+ )
510+ campaign_data = {"CampaignConfig" : campaign .model_dump (by_alias = True )}
511+ s3_client .put_object (
512+ Bucket = rules_bucket , Key = f"{ campaign .name } .json" , Body = json .dumps (campaign_data ), ContentType = "application/json"
513+ )
514+ yield campaign
515+ s3_client .delete_object (Bucket = rules_bucket , Key = f"{ campaign .name } .json" )
516+
483517
484518@pytest .fixture (scope = "class" )
485519def multiple_campaign_configs (s3_client : BaseClient , rules_bucket : BucketName ) -> Generator [list [CampaignConfig ]]:
0 commit comments