From 78a1d0cdcd6743562c4fe04edd53380bc52126a3 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Tue, 19 Dec 2023 09:13:40 +0100 Subject: [PATCH] Align tests with redturtle.prenotazioni > 2.2.5 (#33) * Align tests with redturtle.prenotazioni > 2.2.5. * remove slow job --- .github/workflows/tests.yml | 86 +++++++++---------- CHANGES.rst | 3 +- .../ioprenoto/tests/test_stringinterp.py | 16 ++-- 3 files changed, 52 insertions(+), 53 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9f2b5c1..cbde1ba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,42 +12,41 @@ jobs: fail-fast: true matrix: config: - - ["3.8", "py38-plone60"] - - ["3.9", "py39-plone60"] - - ["3.10", "py310-plone60"] - - ["3.11", "py311-plone60"] + - ["3.9", "py39-plone60"] + - ["3.10", "py310-plone60"] + - ["3.11", "py311-plone60"] name: ${{ matrix.config[1] }} steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.config[0] }} - - name: Pip cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/pip - eggs - .tox - key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.config[0] }}- - ${{ runner.os }}-pip- - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install tox - - name: Test - run: tox -e ${{ matrix.config[1] }} - - name: Upload coverage data to coveralls.io - run: | - pip install coveralls - coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: ${{ matrix.config[1] }} - COVERALLS_PARALLEL: true + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.config[0] }} + - name: Pip cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + eggs + .tox + key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.config[0] }}- + ${{ runner.os }}-pip- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Test + run: tox -e ${{ matrix.config[1] }} + - name: Upload coverage data to coveralls.io + run: | + pip install coveralls + coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: ${{ matrix.config[1] }} + COVERALLS_PARALLEL: true # - name: Upload coverage data to coveralls.io # uses: coverallsapp/github-action@v2 # with: @@ -59,13 +58,12 @@ jobs: # if: ${{ always() }} runs-on: ubuntu-latest steps: - - name: Coveralls Finished - run: | - pip install --upgrade coveralls - coveralls --service=github --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # uses: coverallsapp/github-action@v2 - # with: - # parallel-finished: true - \ No newline at end of file + - name: Coveralls Finished + run: | + pip install --upgrade coveralls + coveralls --service=github --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # uses: coverallsapp/github-action@v2 + # with: + # parallel-finished: true diff --git a/CHANGES.rst b/CHANGES.rst index 985a792..645d296 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 1.2.1 (unreleased) ------------------ -- Nothing changed yet. +- Align tests with redturtle.prenotazioni > 2.2.5. + [cekk] 1.2.0 (2023-11-20) diff --git a/src/design/plone/ioprenoto/tests/test_stringinterp.py b/src/design/plone/ioprenoto/tests/test_stringinterp.py index 480927d..327243a 100644 --- a/src/design/plone/ioprenoto/tests/test_stringinterp.py +++ b/src/design/plone/ioprenoto/tests/test_stringinterp.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import unittest -from datetime import date, datetime +from datetime import datetime import transaction from plone import api @@ -9,6 +9,7 @@ from plone.stringinterp.interfaces import IContextWrapper, IStringSubstitution from plone.volto.interfaces import IVoltoSettings from redturtle.prenotazioni.adapters.booker import IBooker +from redturtle.prenotazioni.tests.helpers import WEEK_TABLE_SCHEMA from z3c.relationfield.relation import RelationValue from zope.component import getAdapter, getUtility, queryUtility from zope.intid.interfaces import IIntIds @@ -25,6 +26,8 @@ def setUp(self): self.portal_url = self.portal.absolute_url() setRoles(self.portal, TEST_USER_ID, ["Manager"]) + self.today = datetime.now() + self.unita_organizzativa = api.content.create( container=self.portal, type="UnitaOrganizzativa", @@ -45,18 +48,15 @@ def setUp(self): type="PrenotazioniFolder", title="Prenota foo", description="", - daData=date.today(), + daData=self.today.date(), gates=["Gate A"], uffici_correlati=[ RelationValue( to_id=queryUtility(IIntIds).getId(self.unita_organizzativa) ) ], + week_table=WEEK_TABLE_SCHEMA, ) - 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", @@ -79,9 +79,9 @@ def setUp(self): ) booker = IBooker(self.folder_prenotazioni) - self.prenotazione = booker.create( + self.prenotazione = booker.book( { - "booking_date": datetime.now(), + "booking_date": self.today.replace(hour=8, minute=0), "booking_type": "Type A", "title": "foo", }