diff --git a/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py b/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py index 7c82ab9..be63c89 100644 --- a/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py +++ b/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py @@ -5,10 +5,13 @@ TEST_USER_ID, setRoles, ) -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING +from design.plone.ioprenoto.testing import ( + DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING, +) from datetime import datetime from plone.registry.interfaces import IRegistry from plone.stringinterp.interfaces import IStringSubstitution +from plone.stringinterp.interfaces import IContextWrapper from plone.volto.interfaces import IVoltoSettings from redturtle.prenotazioni.adapters.booker import IBooker from zope.component import getAdapter @@ -91,9 +94,13 @@ def setUp(self): ) year = api.content.create( - container=self.folder_prenotazioni, type="PrenotazioniYear", title="Year" + container=self.folder_prenotazioni, + type="PrenotazioniYear", + title="Year", + ) + week = api.content.create( + container=year, type="PrenotazioniWeek", title="Week" ) - week = api.content.create(container=year, type="PrenotazioniWeek", title="Week") self.day_folder = api.content.create( container=week, type="PrenotazioniDay", title="Day" ) @@ -113,7 +120,9 @@ def test_booking_print_url_override( self, ): self.assertEqual( - getAdapter(self.prenotazione, IStringSubstitution, "booking_print_url")(), + getAdapter( + self.prenotazione, IStringSubstitution, "booking_print_url" + )(), f"{self.portal_url}/prenotazione-appuntamenti-uffici?booking_id={self.prenotazione.UID()}", ) @@ -122,7 +131,7 @@ def test_booking_print_url_with_delete_token_override( ): self.assertEqual( getAdapter( - self.prenotazione, + IContextWrapper(self.prenotazione), IStringSubstitution, "booking_print_url_with_delete_token", )(), @@ -133,10 +142,16 @@ def test_booking_print_url_override_with_custom_frontend_domain( self, ): registry = getUtility(IRegistry) - settings = registry.forInterface(IVoltoSettings, prefix="volto", check=False) + settings = registry.forInterface( + IVoltoSettings, prefix="volto", check=False + ) settings.frontend_domain = "http://foo.bar" self.assertEqual( - getAdapter(self.prenotazione, IStringSubstitution, "booking_print_url")(), + getAdapter( + IContextWrapper(self.prenotazione), + IStringSubstitution, + "booking_print_url", + )(), f"http://foo.bar/prenotazione-appuntamenti-uffici?booking_id={self.prenotazione.UID()}", )