Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 2e7eba0
Author: Roman <roman.kysil@redturtle.it>
Date:   Mon Nov 20 10:34:21 2023 +0100

    Fix test

commit dcb3a0c
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Fri Nov 17 11:32:03 2023 +0100

    add test

commit 40d8c4c
Merge: 5cbbb79 6876f53
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Fri Nov 17 11:17:37 2023 +0100

    Merge branch 'master' into email_vars_extend

commit 6876f53
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Fri Nov 17 11:16:13 2023 +0100

    ci: fix coverage report

commit 44c72f2
Merge: cad610d 73f9f35
Author: Andrea Cecchi <andrea.cecchi85@gmail.com>
Date:   Wed Nov 15 13:47:19 2023 +0100

    Merge pull request #29 from RedTurtle/fix_serializer

    Handle missing infos in prenotazioniFolder serializer

commit 73f9f35
Merge: db2cb63 cad610d
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Tue Nov 14 19:54:44 2023 +0100

    Merge branch 'master' into fix_serializer

commit 5cbbb79
Merge: e179ae7 cad610d
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Tue Nov 14 19:53:06 2023 +0100

    Merge branch 'master' into email_vars_extend

commit cad610d
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Tue Nov 14 19:06:59 2023 +0100

    fix tests (against latest redturtl.prenotazioni)

commit db2cb63
Merge: 31f0592 189b208
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Tue Nov 14 17:28:19 2023 +0100

    Merge branch 'master' into fix_serializer

commit e179ae7
Author: Roman <roman.kysil@redturtle.it>
Date:   Tue Nov 14 17:26:37 2023 +0100

    Fix changes

commit 189b208
Author: Mauro Amico <mauro.amico@gmail.com>
Date:   Tue Nov 14 17:25:57 2023 +0100

    ci: add .tox in cache

commit a635b07
Author: Roman <roman.kysil@redturtle.it>
Date:   Tue Nov 14 17:21:33 2023 +0100

    Extend the email vars list

commit 1e7f38f
Author: Roman <roman.kysil@redturtle.it>
Date:   Tue Nov 14 17:24:39 2023 +0100

    Squashed commit of the following:

    commit 5e0b976
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Mon Oct 30 16:10:06 2023 +0100

        Revert "Squashed commit of the following:"

        This reverts commit 607c341.

    commit 607c341
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Mon Oct 30 14:24:16 2023 +0100

        Squashed commit of the following:

        commit d2b519c
        Author: Roman <72063601+folix-01@users.noreply.github.com>
        Date:   Thu Oct 26 15:00:05 2023 +0200

            Align to redturtle.prenotazioni newest version

    commit dc5d291
    Merge: 3ee8b9d 932795d
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Mon Oct 16 10:08:36 2023 +0200

        Merge branch 'master' into develop

    commit 3ee8b9d
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Mon Oct 16 10:07:01 2023 +0200

        Formatting fixes

    commit baed96a
    Merge: 77cbfd0 3c64143
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Mon Oct 16 10:06:32 2023 +0200

        Merge branch 'master' into develop

    commit 77cbfd0
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Fri Oct 13 18:04:14 2023 +0200

        Update redturtle.prenotazioni verison to 2.1.3

    commit e4f3034
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Fri Oct 13 17:44:14 2023 +0200

        Fixed imports

    commit 5ec0e3c
    Author: Roman <roman.kysil@redturtle.it>
    Date:   Fri Oct 13 17:28:59 2023 +0200

        Squashed commit of the following:

        commit 3b5583c
        Author: Roman <roman.kysil@redturtle.it>
        Date:   Fri Oct 13 17:27:53 2023 +0200

            Update redturtle.prenotazioni version

        commit ea11622
        Author: Roman <72063601+folix-01@users.noreply.github.com>
        Date:   Fri Oct 13 14:29:48 2023 +0200

            Add the contact info to @bookable-uo-list response (#27)

            * Add the contact info to @bookable-uo-list response

            * Update src/design/plone/ioprenoto/restapi/services/bookable_list/get.py

            Co-authored-by: Mauro Amico <mauro.amico@gmail.com>

            * Use python syntax

            * Update src/design/plone/ioprenoto/restapi/services/bookable_list/get.py

            Co-authored-by: Mauro Amico <mauro.amico@gmail.com>

            ---------

            Co-authored-by: Mauro Amico <mauro.amico@gmail.com>

        commit e2ceb8c
        Author: Roman <roman.kysil@redturtle.it>
        Date:   Wed Oct 11 09:37:56 2023 +0200

            Add changelog

        commit 65911f2
        Author: Roman <roman.kysil@redturtle.it>
        Date:   Wed Oct 11 09:05:01 2023 +0200

            Align with redturtle.prenotazioni>=2.0.1 version

commit 31f0592
Author: Andrea Cecchi <andrea.cecchi85@gmail.com>
Date:   Thu Nov 9 10:09:26 2023 +0100

    Handle missing infos in prenotazioniFolder serializer
  • Loading branch information
folix-01 committed Nov 20, 2023
1 parent 02dd6b8 commit 6460f13
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 44 deletions.
8 changes: 3 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ relative_files = True
include =
*/src/design/plone/ioprenoto/*
omit =
.tox/
eggs/
test/
upgrades/
extras/
*/test*
*/upgrades/*
*/upgrades.py
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
path: |
~/.cache/pip
eggs
.tox
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Changelog
- Compatibilize with the 2.0.1 redturtle.prenotazioni version.
- Add the UO.contact_info field to @bookable-uo-list response.
[folix-01]
- Handle missing infos in prenotazioniFolder serializer.
[cekk]

- Compatibilize with the 2.0.1 redturtle.prenotazioni version.
[folix-01]
- Add the UO.contact_info field to @bookable-uo-list response.
[folix-01]
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@
extras_require={
"test": [
"plone.app.testing",
# Plone KGS does not use this version, because it would break
# Remove if your package shall be part of coredev.
# plone_coredev tests as of 2016-04-01.
"plone.testing>=5.0.0",
"plone.app.contenttypes",
"plone.app.robotframework[debug]",
"collective.MockMailHost",
"redturtle.prenotazioni[test]",
"design.plone.policy[test]",
"redturtle.prenotazioni",
"design.plone.policy",
],
},
entry_points="""
Expand Down
9 changes: 9 additions & 0 deletions src/design/plone/ioprenoto/adapters/stringinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,19 @@ def safe_call(self):
next(
iter(
getattr(
<<<<<<< HEAD
self.context.getPrenotazioniFolder(), "uffici_correlati", []
)
),
None,
=======
self.context.getPrenotazioniFolder(),
"uffici_correlati",
None,
)
or [None]
),
>>>>>>> email_vars_extend
),
"to_object",
None,
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_custom_booking_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,23 @@ def setUp(self):
title="Prenota foo",
description="",
daData=date.today(),
booking_types=[
{"name": "Type A", "duration": "30"},
],
gates=["Gate A"],
required_booking_fields=["email", "fiscalcode"],
)
week_table = self.folder_prenotazioni.week_table
week_table[0]["morning_start"] = "0700"
week_table[0]["morning_end"] = "1000"
self.folder_prenotazioni.week_table = week_table
api.content.transition(
obj=api.content.create(
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
gates=["all"],
),
transition="publish",
)

year = api.content.create(
container=self.folder_prenotazioni, type="PrenotazioniYear", title="Year"
Expand Down
11 changes: 8 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,22 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,18 @@ def setUp(self):
to_id=queryUtility(IIntIds).getId(self.unita_organizzativa)
)
],
booking_types=[
{"name": "Type A", "duration": "30"},
],
)
api.content.transition(
obj=api.content.create(
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.prenotazioni_folder,
gates=["all"],
),
transition="publish",
)

self.prenotazioni_folder2 = api.content.create(
container=self.portal,
type="PrenotazioniFolder",
Expand All @@ -88,10 +96,26 @@ def setUp(self):
to_id=queryUtility(IIntIds).getId(self.unita_organizzativa)
)
],
booking_types=[
{"name": "Type A", "duration": "10"},
{"name": "Type B", "duration": "30"},
],
)
api.content.transition(
obj=api.content.create(
type="PrenotazioneType",
title="Type A",
duration=10,
container=self.prenotazioni_folder2,
gates=["all"],
),
transition="publish",
)
api.content.transition(
obj=api.content.create(
type="PrenotazioneType",
title="Type B",
duration=30,
container=self.prenotazioni_folder2,
gates=["all"],
),
transition="publish",
)
self.prenotazioni_folder3 = api.content.create(
container=self.portal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
from plone.stringinterp.interfaces import IContextWrapper, 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, getUtility, queryUtility
from zope.intid.interfaces import IIntIds

from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING


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

def setUp(self):
Expand All @@ -23,21 +25,48 @@ def setUp(self):
self.portal_url = self.portal.absolute_url()
setRoles(self.portal, TEST_USER_ID, ["Manager"])

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.folder_prenotazioni = api.content.create(
container=self.portal,
type="PrenotazioniFolder",
title="Prenota foo",
description="",
daData=date.today(),
booking_types=[
{"name": "Type A", "duration": "30"},
],
gates=["Gate A"],
uffici_correlati=[
RelationValue(
to_id=queryUtility(IIntIds).getId(self.unita_organizzativa)
)
],
)
week_table = self.folder_prenotazioni.week_table
week_table[0]["morning_start"] = "0700"
week_table[0]["morning_end"] = "1000"
self.folder_prenotazioni.week_table = week_table
api.content.transition(
obj=api.content.create(
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
gates=["all"],
),
transition="publish",
)

year = api.content.create(
container=self.folder_prenotazioni,
Expand Down Expand Up @@ -107,3 +136,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.unita_organizzativa.Title(),
)
11 changes: 0 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ skip_missing_interpreters = True
[coverage:run]
relative_files = True

[coverage:report]
include =
*/src/design/plone/ioprenoto/*

omit =
.tox/
eggs/
test/
upgrades/
extras/

[testenv]
skip_install = true
extras =
Expand Down

0 comments on commit 6460f13

Please sign in to comment.