From 189b208614eaabb6ae8c8d40e84dc4eb9f643afd Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Tue, 14 Nov 2023 17:25:57 +0100 Subject: [PATCH 1/2] ci: add .tox in cache --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63e1928..6adbe79 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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] }}- From cad610d271df50877fa83ba94a696144104853da Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Tue, 14 Nov 2023 19:06:59 +0100 Subject: [PATCH 2/2] fix tests (against latest redturtl.prenotazioni) --- setup.py | 7 +--- .../tests/test_custom_booking_schema.py | 13 +++++-- .../ioprenoto/tests/test_prenotazione_add.py | 13 +++++-- .../test_restapi_service_bookable_list.py | 38 +++++++++++++++---- .../tests/test_stringinterp_overrides.py | 13 +++++-- 5 files changed, 63 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index 2effbf2..98869d6 100644 --- a/setup.py +++ b/setup.py @@ -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=""" diff --git a/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py b/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py index a61170b..0e1431f 100644 --- a/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py +++ b/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py @@ -36,9 +36,6 @@ 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"], ) @@ -46,6 +43,16 @@ def setUp(self): 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" diff --git a/src/design/plone/ioprenoto/tests/test_prenotazione_add.py b/src/design/plone/ioprenoto/tests/test_prenotazione_add.py index d239c74..bc58044 100644 --- a/src/design/plone/ioprenoto/tests/test_prenotazione_add.py +++ b/src/design/plone/ioprenoto/tests/test_prenotazione_add.py @@ -23,9 +23,6 @@ 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 @@ -33,6 +30,16 @@ def setUp(self): row["morning_start"] = "0700" row["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", + ) api.content.transition(obj=self.folder_prenotazioni, transition="publish") transaction.commit() diff --git a/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py b/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py index e422fab..4373821 100644 --- a/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py +++ b/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py @@ -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", @@ -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, diff --git a/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py b/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py index ce6aea4..ea2248c 100644 --- a/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py +++ b/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py @@ -29,15 +29,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 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,