Skip to content

Commit

Permalink
(PC-34441)[API] fix: fix patch draft offer with empty ean
Browse files Browse the repository at this point in the history
  • Loading branch information
pcharlet-pass committed Feb 7, 2025
1 parent c1971b7 commit f125972
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/src/pcapi/core/offers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def update_draft_offer(offer: models.Offer, body: offers_schemas.PatchDraftOffer
offer.subcategoryId, formatted_extra_data, offer.venue, is_from_private_api=True, offer=offer
)
# TODO: (pcharlet, 2025-02-04): Delete next line when body schemas contains specific EAN field outside extraData
updates.update({"ean": updates["extraData"].get("ean", None)})
updates.update({"ean": formatted_extra_data.get("ean", None)})

for key, value in updates.items():
setattr(offer, key, value)
Expand Down
2 changes: 2 additions & 0 deletions api/tests/routes/pro/patch_draft_offer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def test_patch_draft_offer_with_empty_extra_data(self, client):
"speaker": "",
"stageDirector": "",
"visa": "",
"ean": "",
},
}
response = client.with_session_auth("user@example.com").patch(f"/offers/draft/{offer.id}", json=data)
Expand All @@ -170,6 +171,7 @@ def test_patch_draft_offer_with_empty_extra_data(self, client):
"speaker": "",
"stageDirector": "",
"visa": "",
"ean": "",
}

@pytest.mark.features(WIP_EAN_CREATION=False)
Expand Down

0 comments on commit f125972

Please sign in to comment.