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

Commit

Permalink
(PC-8557): add allocine price in post venuePRovider serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliochka committed Aug 18, 2021
1 parent 8aee03d commit 78f7198
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pcapi/routes/pro/venue_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def create_venue_provider(body: PostVenueProviderBody) -> VenueProviderResponse:

new_venue_provider = api.create_venue_provider(body)
venue_provider_job.delay(new_venue_provider.id)
if new_venue_provider.isFromAllocineProvider:
new_venue_provider.price = _allocine_venue_provider_price(new_venue_provider)

return VenueProviderResponse.from_orm(new_venue_provider)

Expand Down
4 changes: 4 additions & 0 deletions tests/routes/pro/get_venue_providers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def test_get_list_that_include_allocine_with_valid_venue_id(self, app):
venue__name="Whatever cinema",
provider=allocine_stocks_provider,
)
offerers_factories.AllocineVenueProviderPriceRuleFactory(
price=123.2, allocineVenueProvider=allocine_venue_provider
)

# when
auth_request = TestClient(app.test_client()).with_auth(email=user.email)
Expand All @@ -46,6 +49,7 @@ def test_get_list_that_include_allocine_with_valid_venue_id(self, app):
assert response.status_code == 200
assert response.json["venue_providers"][0].get("id") == humanize(allocine_venue_provider.id)
assert response.json["venue_providers"][0].get("venueId") == humanize(allocine_venue_provider.venue.id)
assert response.json["venue_providers"][0].get("price") == 123.2


class Returns400Test:
Expand Down
1 change: 1 addition & 0 deletions tests/routes/pro/post_venue_provider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def when_add_allocine_stocks_provider_with_default_settings_at_import(self, app)

# Then
assert response.status_code == 201
assert response.json["price"] == 9.99

@pytest.mark.usefixtures("db_session")
@patch("pcapi.workers.venue_provider_job.venue_provider_job.delay")
Expand Down

0 comments on commit 78f7198

Please sign in to comment.