Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
(PC-10534): add nonhumanized id on get offer route
Browse files Browse the repository at this point in the history
  • Loading branch information
damienPassCulture committed Sep 29, 2021
1 parent 87958c0 commit 583041b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pcapi/routes/serialization/offers_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ class GetOfferResponseModel(BaseModel):
audioDisabilityCompliant: Optional[bool]
mentalDisabilityCompliant: Optional[bool]
motorDisabilityCompliant: Optional[bool]
nonHumanizedId: int
visualDisabilityCompliant: Optional[bool]
lastProvider: Optional[GetOfferLastProviderResponseModel]
lastProviderId: Optional[str]
Expand Down Expand Up @@ -533,6 +534,7 @@ def extract_datetime_list_from_DateTimes_type( # pylint: disable=no-self-argume
@classmethod
def from_orm(cls, offer): # type: ignore
offer.subcategoryId = offer.subcategoryId or get_subcategory_from_type(offer.type, offer.venue.isVirtual)
offer.nonHumanizedId = offer.id
return super().from_orm(offer)

class Config:
Expand Down
2 changes: 2 additions & 0 deletions tests/routes/pro/get_offer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_access_by_beneficiary(self, app):
assert "bic" not in response_json["venue"]["managingOfferer"]
assert "validationToken" not in response_json["venue"]["managingOfferer"]
assert "thumbUrl" in response_json
assert response_json["nonHumanizedId"] == offer.id

def test_access_even_if_offerer_has_no_siren(self, app):
# Given
Expand Down Expand Up @@ -141,6 +142,7 @@ def test_returns_an_event_stock(self, app):
"mediaUrls": [],
"mediations": [],
"name": "Derrick",
"nonHumanizedId": stock.offer.id,
"offerType": {
"appLabel": "Cinéma",
"canExpire": None,
Expand Down

0 comments on commit 583041b

Please sign in to comment.