File tree Expand file tree Collapse file tree 4 files changed +39
-7
lines changed Expand file tree Collapse file tree 4 files changed +39
-7
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ class ActionParams(BaseModel, frozen=True):
100
100
"S4" : "S4" ,
101
101
}
102
102
cf_fx_points_map : dict [str , int ] = {
103
+ "---" : 0 ,
103
104
"" : 0 ,
104
105
"?" : 0 ,
105
106
"1" : 1 ,
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def timestamp(self) -> datetime:
104
104
@computed_field # type: ignore
105
105
@property
106
106
def identifier (self ) -> str :
107
- return f"{ self .payload .event .time } -{ self .payload .bug .id } -{ self .payload .event .action } -{ " error" if self .error else " postponed" } "
107
+ return f"{ self .payload .event .time } -{ self .payload .bug .id } -{ self .payload .event .action } -{ ' error' if self .error else ' postponed' } "
108
108
109
109
110
110
@lru_cache (maxsize = 1 )
Original file line number Diff line number Diff line change @@ -113,9 +113,9 @@ async def test_retry_remove_expired(
113
113
114
114
metrics = await retry_failed (item_executor = mock_executor , queue = mock_queue )
115
115
mock_queue .retrieve .assert_called_once ()
116
- assert (
117
- len ( mock_queue . done . call_args_list ) == 2
118
- ), "both items should have been marked as done"
116
+ assert len ( mock_queue . done . call_args_list ) == 2 , (
117
+ "both items should have been marked as done"
118
+ )
119
119
assert caplog .text .count ("failed to reprocess event" ) == 0
120
120
assert caplog .text .count ("removing expired event" ) == 1
121
121
mock_executor .assert_called_once () # only one item should have been attempted to be processed
@@ -140,9 +140,9 @@ async def test_retry_remove_invalid(
140
140
mock .DEFAULT ,
141
141
]
142
142
metrics = await retry_failed (item_executor = mock_executor , queue = mock_queue )
143
- assert (
144
- len ( mock_queue . done . call_args_list ) == 2
145
- ), "both items should have been marked as done"
143
+ assert len ( mock_queue . done . call_args_list ) == 2 , (
144
+ "both items should have been marked as done"
145
+ )
146
146
assert caplog .text .count ("removing invalid event" ) == 1
147
147
assert metrics == {
148
148
"bug_count" : 1 ,
Original file line number Diff line number Diff line change @@ -984,6 +984,37 @@ def test_update_issue_points(
984
984
)
985
985
986
986
987
+ def test_update_issue_points_removed (
988
+ action_context_factory ,
989
+ mocked_jira ,
990
+ action_params_factory ,
991
+ webhook_event_change_factory ,
992
+ ):
993
+ action_context = action_context_factory (
994
+ operation = Operation .UPDATE ,
995
+ current_step = "maybe_update_issue_points" ,
996
+ bug__see_also = ["https://mozilla.atlassian.net/browse/JBI-234" ],
997
+ jira__issue = "JBI-234" ,
998
+ bug__cf_fx_points = "---" ,
999
+ event__action = "modify" ,
1000
+ event__changes = [
1001
+ webhook_event_change_factory (field = "cf_fx_points" , removed = "?" , added = "0" )
1002
+ ],
1003
+ )
1004
+
1005
+ params = action_params_factory (
1006
+ jira_project_key = action_context .jira .project ,
1007
+ )
1008
+ steps .maybe_update_issue_points (
1009
+ action_context , parameters = params , jira_service = JiraService (mocked_jira )
1010
+ )
1011
+
1012
+ mocked_jira .create_issue .assert_not_called ()
1013
+ mocked_jira .update_issue_field .assert_called_with (
1014
+ key = "JBI-234" , fields = {"customfield_10037" : 0 }
1015
+ )
1016
+
1017
+
987
1018
def test_update_issue_points_missing_in_map (
988
1019
action_context_factory ,
989
1020
mocked_jira ,
You can’t perform that action at this time.
0 commit comments