Skip to content

Fixes #1096 - Ignores '---' values for mapped fields on create #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jbi/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _maybe_update_issue_mapped_field(
target_value = getattr(parameters, f"{source_field}_map").get(source_value)

# If field is empty on create, or update is about another field, then nothing to do.
if (context.operation == Operation.CREATE and source_value == "") or (
if (context.operation == Operation.CREATE and source_value in ["", "---"]) or (
context.operation == Operation.UPDATE
and source_field not in context.event.changed_fields()
):
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,30 @@ def test_update_issue_points_removed(
)


def test_empty_issue_points_ignored_on_create(
action_context_factory,
mocked_jira,
action_params_factory,
webhook_event_change_factory,
):
action_context = action_context_factory(
operation=Operation.CREATE,
current_step="maybe_update_issue_points",
bug__see_also=["https://mozilla.atlassian.net/browse/JBI-234"],
jira__issue="JBI-234",
bug__cf_fx_points="---",
)

params = action_params_factory(
jira_project_key=action_context.jira.project,
)
steps.maybe_update_issue_points(
action_context, parameters=params, jira_service=JiraService(mocked_jira)
)

mocked_jira.update_issue_field.assert_not_called()


def test_update_issue_points_missing_in_map(
action_context_factory,
mocked_jira,
Expand Down
Loading