Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Nov 17, 2023
1 parent 40d8c4c commit dcb3a0c
Showing 1 changed file with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
# -*- coding: utf-8 -*-
import unittest
from datetime import date, datetime

import transaction
from datetime import date
from datetime import datetime
from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING
from plone import api
from plone.app.testing import TEST_USER_ID, setRoles
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.registry.interfaces import IRegistry
from plone.stringinterp.interfaces import IContextWrapper, IStringSubstitution
from plone.stringinterp.interfaces import IContextWrapper
from plone.stringinterp.interfaces import IStringSubstitution
from plone.volto.interfaces import IVoltoSettings
from redturtle.prenotazioni.adapters.booker import IBooker
from zope.component import getAdapter, getUtility
from z3c.relationfield.relation import RelationValue
from zope.component import getAdapter
from zope.component import getUtility
from zope.component import queryUtility
from zope.intid.interfaces import IIntIds

from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING
import transaction
import unittest


class TestStringinterpOverrides(unittest.TestCase):
class TestStringinterp(unittest.TestCase):
layer = DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -64,6 +70,31 @@ def setUp(self):
"title": "foo",
}
)
self.unita_organizzativa = api.content.create(
container=self.portal,
type="UnitaOrganizzativa",
title="UO",
)
self.servizio = api.content.create(
container=self.portal,
type="Servizio",
title="Servizio",
ufficio_responsabile=[
RelationValue(
to_id=queryUtility(IIntIds).getId(self.unita_organizzativa)
)
],
)
self.prenotazioni_folder = api.content.create(
container=self.portal,
type="PrenotazioniFolder",
title="Prenotazioni Folder",
uffici_correlati=[
RelationValue(
to_id=queryUtility(IIntIds).getId(self.unita_organizzativa)
)
],
)

transaction.commit()

Expand Down Expand Up @@ -114,3 +145,11 @@ def test_booking_print_url_override_with_custom_frontend_domain(
)(),
f"http://foo.bar/prenotazione-appuntamenti-uffici?booking_id={self.prenotazione.UID()}",
)

def test_unita_organizzativa_title(self):
self.assertEqual(
getAdapter(
self.prenotazione, IStringSubstitution, "unita_organizzativa_title"
)(),
self.folder_prenotazioni.Title(),
)

0 comments on commit dcb3a0c

Please sign in to comment.