Skip to content
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: 2 additions & 0 deletions jbi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class BugzillaWebhookUser(BaseModel):
class BugzillaWebhookEventChange(BaseModel):
"""Bugzilla Change Object"""

model_config = ConfigDict(coerce_numbers_to_str=True)

field: str
removed: str
added: str
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ def test_payload_changes_list(webhook_event_change_factory, webhook_event_factor
]


def test_payload_changes_coerces_numbers_to_strings(
webhook_event_change_factory, webhook_event_factory
):
changes = [
webhook_event_change_factory(field="is_confirmed", removed="1", added=0),
]
event = webhook_event_factory(routing_key="bug.modify", changes=changes)
assert event.changed_fields() == ["is_confirmed"]
assert event.changes[0].added == "0"


def test_max_configured_projects_raises_error(action_factory):
actions = [action_factory(whiteboard_tag=str(i)) for i in range(51)]
with pytest.raises(pydantic.ValidationError):
Expand Down