@@ -143,34 +143,39 @@ def test_approval_maximum(self, approval_maximum, valid_campaign_config_with_onl
143143
144144
145145class TestIterationCohortsSchemaValidations :
146- def test_valid_iteration_if_actions_mapper_has_entry_for_the_provided_default_routing_key (self , valid_campaign_config_with_only_mandatory_fields ):
146+ def test_valid_iteration_if_actions_mapper_has_entry_for_the_provided_default_routing_key (
147+ self , valid_campaign_config_with_only_mandatory_fields
148+ ):
147149 expected_action = {
148150 "ExternalRoutingCode" : "BookLocal" ,
149151 "ActionDescription" : "##Getting the vaccine\n "
150- "You can get an RSV vaccination at your GP surgery.\n "
151- "Your GP surgery may contact you about getting the RSV vaccine. "
152- "This may be by letter, text, phone call, email or through the NHS App. "
153- "You do not need to wait to be contacted before booking your vaccination." ,
154- "ActionType" : "InfoText"
152+ "You can get an RSV vaccination at your GP surgery.\n "
153+ "Your GP surgery may contact you about getting the RSV vaccine. "
154+ "This may be by letter, text, phone call, email or through the NHS App. "
155+ "You do not need to wait to be contacted before booking your vaccination." ,
156+ "ActionType" : "InfoText" ,
155157 }
156158
157- data = {** valid_campaign_config_with_only_mandatory_fields ["Iterations" ][0 ],
158- "DefaultCommsRouting" : "BOOK_LOCAL" , "ActionsMapper" : {
159- "BOOK_LOCAL" : expected_action
160- }}
159+ data = {
160+ ** valid_campaign_config_with_only_mandatory_fields ["Iterations" ][0 ],
161+ "DefaultCommsRouting" : "BOOK_LOCAL" ,
162+ "ActionsMapper" : {"BOOK_LOCAL" : expected_action },
163+ }
161164 IterationValidation (** data )
162165
163- def test_invalid_iteration_if_actions_mapper_has_no_entry_for_the_provided_default_routing_key (self , valid_campaign_config_with_only_mandatory_fields ):
164- data = {** valid_campaign_config_with_only_mandatory_fields ["Iterations" ][0 ],
165- "DefaultCommsRouting" : "BOOK_LOCAL" , "ActionsMapper" : {}} # Missing BOOK_LOCAL in ActionsMapper
166+ def test_invalid_iteration_if_actions_mapper_has_no_entry_for_the_provided_default_routing_key (
167+ self , valid_campaign_config_with_only_mandatory_fields
168+ ):
169+ data = {
170+ ** valid_campaign_config_with_only_mandatory_fields ["Iterations" ][0 ],
171+ "DefaultCommsRouting" : "BOOK_LOCAL" ,
172+ "ActionsMapper" : {},
173+ } # Missing BOOK_LOCAL in ActionsMapper
166174
167175 with pytest .raises (ValidationError ) as error :
168176 IterationValidation (** data )
169177
170178 errors = error .value .errors ()
171- assert any (
172- e ["loc" ][- 1 ] == "actions_mapper" and "BOOK_LOCAL" in str (e ["msg" ])
173- for e in errors
174- ), "Expected validation error for missing BOOK_LOCAL entry in ActionsMapper"
175-
176-
179+ assert any (e ["loc" ][- 1 ] == "actions_mapper" and "BOOK_LOCAL" in str (e ["msg" ]) for e in errors ), (
180+ "Expected validation error for missing BOOK_LOCAL entry in ActionsMapper"
181+ )
0 commit comments