@@ -866,6 +866,73 @@ def test_update_issue_unknown_severity(
866
866
assert capturelogs .messages == ["Bug severity 'S3' was not in the severity map." ]
867
867
868
868
869
+ def test_update_issue_points (
870
+ action_context_factory ,
871
+ mocked_jira ,
872
+ action_params_factory ,
873
+ webhook_event_change_factory ,
874
+ ):
875
+ action_context = action_context_factory (
876
+ operation = Operation .UPDATE ,
877
+ current_step = "maybe_update_issue_points" ,
878
+ bug__see_also = ["https://mozilla.atlassian.net/browse/JBI-234" ],
879
+ jira__issue = "JBI-234" ,
880
+ bug__cf_fx_points = "15" ,
881
+ event__action = "modify" ,
882
+ event__changes = [
883
+ webhook_event_change_factory (field = "cf_fx_points" , removed = "?" , added = "15" )
884
+ ],
885
+ )
886
+
887
+ params = action_params_factory (
888
+ jira_project_key = action_context .jira .project ,
889
+ )
890
+ steps .maybe_update_issue_points (
891
+ action_context , parameters = params , jira_service = JiraService (mocked_jira )
892
+ )
893
+
894
+ mocked_jira .create_issue .assert_not_called ()
895
+ mocked_jira .update_issue_field .assert_called_with (
896
+ key = "JBI-234" , fields = {"customfield_10037" : 15 }
897
+ )
898
+
899
+
900
+ def test_update_issue_points_missing_in_map (
901
+ action_context_factory ,
902
+ mocked_jira ,
903
+ action_params_factory ,
904
+ webhook_event_change_factory ,
905
+ capturelogs ,
906
+ ):
907
+ action_context = action_context_factory (
908
+ operation = Operation .UPDATE ,
909
+ current_step = "maybe_update_issue_points" ,
910
+ bug__see_also = ["https://mozilla.atlassian.net/browse/JBI-234" ],
911
+ jira__issue = "JBI-234" ,
912
+ bug__cf_fx_points = "42" ,
913
+ event__action = "modify" ,
914
+ event__changes = [
915
+ webhook_event_change_factory (field = "cf_fx_points" , removed = "?" , added = "42" )
916
+ ],
917
+ )
918
+
919
+ params = action_params_factory (
920
+ jira_project_key = action_context .jira .project ,
921
+ )
922
+
923
+ with capturelogs .for_logger ("jbi.steps" ).at_level (logging .DEBUG ):
924
+ result , _ = steps .maybe_update_issue_points (
925
+ action_context , parameters = params , jira_service = JiraService (mocked_jira )
926
+ )
927
+
928
+ assert result == steps .StepStatus .INCOMPLETE
929
+ mocked_jira .create_issue .assert_not_called ()
930
+ mocked_jira .update_issue_field .assert_not_called ()
931
+ assert capturelogs .messages == [
932
+ "Bug cf_fx_points '42' was not in the cf_fx_points map."
933
+ ]
934
+
935
+
869
936
@pytest .mark .parametrize (
870
937
"project_components,bug_component,config_components,expected_jira_components,expected_logs" ,
871
938
[
0 commit comments