Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jul 31, 2023
1 parent 44faf77 commit f4df176
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Expand All @@ -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()}",
)

Expand All @@ -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",
)(),
Expand All @@ -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()}",
)

0 comments on commit f4df176

Please sign in to comment.