@@ -710,6 +710,34 @@ def test_maybe_update_components_raises_incompletesteperror_on_mismatch(
710
710
steps .maybe_update_components (context_update_example , action_params )
711
711
712
712
713
+ def test_maybe_update_components_failing (
714
+ context_update_example : ActionContext , mocked_jira , caplog , action_params_factory
715
+ ):
716
+ mocked_jira .get_project_components .return_value = [
717
+ {"id" : 1 , "name" : context_update_example .bug .component }
718
+ ]
719
+ mocked_jira .update_issue_field .side_effect = requests .exceptions .HTTPError (
720
+ "Field 'components' cannot be set" , response = mock .MagicMock (status_code = 400 )
721
+ )
722
+ context_update_example .current_step = "maybe_update_components"
723
+
724
+ action_params = action_params_factory (
725
+ jira_project_key = context_update_example .jira .project ,
726
+ )
727
+ with pytest .raises (IncompleteStepError ):
728
+ with caplog .at_level (logging .DEBUG ):
729
+ steps .maybe_update_components (
730
+ context = context_update_example , parameters = action_params
731
+ )
732
+
733
+ captured_log_msgs = [
734
+ r .msg % r .args for r in caplog .records if r .name == "jbi.steps"
735
+ ]
736
+ assert captured_log_msgs == [
737
+ "Could not set components on issue JBI-234: Field 'components' cannot be set"
738
+ ]
739
+
740
+
713
741
def test_sync_whiteboard_labels (
714
742
context_create_example : ActionContext , mocked_jira , action_params_factory
715
743
):
0 commit comments