Skip to content
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

Handle missing infos in prenotazioniFolder serializer #29

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
1.1.11 (unreleased)
-------------------

- Nothing changed yet.
- Handle missing infos in prenotazioniFolder serializer.
[cekk]


1.1.10 (2023-10-16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def __call__(self, *args, **kwargs):
):
# XXX: this is a workaround to avoid the Unauthorized exception
return {
"@components": resp["@components"],
"@id": resp["@id"],
"@type": resp["@type"],
"layout": resp["layout"],
"title": resp["title"],
"@components": resp.get("@components", {}),
"@id": resp.get("@id", ""),
"@type": resp.get("@type", ""),
"layout": resp.get("@layout", ""),
"title": resp.get("@title", ""),
"error": "Unauthorized",
"anonymous": api.user.is_anonymous(),
}
Expand Down
13 changes: 10 additions & 3 deletions src/design/plone/ioprenoto/tests/test_prenotazione_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,24 @@ def setUp(self):
title="Prenota foo",
description="",
daData=date.today(),
booking_types=[
{"name": "Type A", "duration": "30"},
],
gates=["Gate A"],
)
week_table = self.folder_prenotazioni.week_table
for row in week_table:
row["morning_start"] = "0700"
row["morning_end"] = "1000"
self.folder_prenotazioni.week_table = week_table

booking_type_a = api.content.create(
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
gates=["all"],
)

api.content.transition(obj=self.folder_prenotazioni, transition="publish")
api.content.transition(obj=booking_type_a, transition="publish")
transaction.commit()

self.api_session = RelativeSession(self.portal_url)
Expand Down
Loading