From 8946b5d8f6604f854257ac80a0e22c59d4cb875e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 1/14] Drop the dependency on python-kitchen --- diff --git a/README.rst b/README.rst index e3d274d..9c2d379 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,6 @@ Dependencies: .. _python-sqlalchemy: http://www.sqlalchemy.org/ .. _python-vobject: http://vobject.skyhouseconsulting.com/ .. _iCal: http://en.wikipedia.org/wiki/ICalendar -.. _python-kitchen: http://packages.python.org/kitchen/ .. _alembic: https://bitbucket.org/zzzeek/alembic .. _python-alembic: http://pypi.python.org/pypi/alembic .. _pytz: http://pytz.sourceforge.net/ diff --git a/fedocal.spec b/fedocal.spec index c11aa72..36238ee 100644 --- a/fedocal.spec +++ b/fedocal.spec @@ -31,7 +31,6 @@ BuildRequires: python%{pyversion}-flask-wtf BuildRequires: python%{pyversion}-devel BuildRequires: python%{pyversion}-pytz BuildRequires: python%{pyversion}-vobject -BuildRequires: python%{pyversion}-kitchen BuildRequires: python%{pyversion}-fedora >= 0.3.33 BuildRequires: python%{pyversion}-fedora-flask >= 0.3.33 BuildRequires: python%{pyversion}-alembic @@ -57,7 +56,6 @@ Requires: python%{pyversion}-flask Requires: python%{pyversion}-sqlalchemy > 0.5 Requires: python%{pyversion}-pytz Requires: python%{pyversion}-vobject -Requires: python%{pyversion}-kitchen Requires: python%{pyversion}-fedora >= 0.3.32.3-3 Requires: python%{pyversion}-fedora-flask Requires: python%{pyversion}-alembic diff --git a/requirements.txt b/requirements.txt index 7312293..c27be35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ flask-wtf flask flask-babel flask-oidc -kitchen mock==1.1.2 python-dateutil #<= 1.5 python-fedora>=0.3.33 From 00e12c9cd5995c56592da22c68b48c7687693fde Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 2/14] Update the information regarding the dependencies in the README --- diff --git a/README.rst b/README.rst index 9c2d379..2c9a798 100644 --- a/README.rst +++ b/README.rst @@ -19,20 +19,13 @@ Documentation: http://fedocal.rtfd.org Dependencies: ------------- -.. _python: http://www.python.org .. _Flask: http://flask.pocoo.org/ -.. _python-flask: http://flask.pocoo.org/ -.. _python-flask-wtf: http://packages.python.org/Flask-WTF/ -.. _python-wtforms: http://wtforms.simplecodes.com/docs/1.0.1/ .. _SQLAlchemy: http://www.sqlalchemy.org/ -.. _python-sqlalchemy: http://www.sqlalchemy.org/ -.. _python-vobject: http://vobject.skyhouseconsulting.com/ -.. _iCal: http://en.wikipedia.org/wiki/ICalendar .. _alembic: https://bitbucket.org/zzzeek/alembic -.. _python-alembic: http://pypi.python.org/pypi/alembic +.. _iCal: http://en.wikipedia.org/wiki/ICalendar +.. _python-vobject: http://vobject.skyhouseconsulting.com/ .. _pytz: http://pytz.sourceforge.net/ .. _dateutil: http://labix.org/python-dateutil -.. _python-dateutil: http://pypi.python.org/pypi/python-dateutil This project is a `Flask`_ application. The calendars and meetings are stored into a relational database using `SQLAlchemy`_ as Object Relational @@ -41,22 +34,7 @@ fedocal provides an `iCal`_ feed for each calendar and relies on `python-vobject`_ for this. Finally, `pytz`_ is used to handle the timezone changes and `dateutil`_ to allow date manipulation over months/years. - -The dependency list is therefore: - -- `python`_ (2.5 minimum) -- `python-flask`_ -- `python-flask-wtf`_ -- `python-wtforms`_ -- `python-sqlalchemy`_ -- `python-vobject`_ -- `python-kitchen`_ -- `python-alembic`_ -- `pytz`_ -- `python-dateutil`_ -- `python-fedora-messaging`_ -- `python-flask-multistatic`_ -- `python-flask-oidc`_ +The full list of dependencies can be found ine the ``requirements.txt`` file. Running a development instance: From 107253916cd33ac329fcaa2acdf77a1b3a000b29 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 3/14] Describe the different git branches in the project and their goal --- diff --git a/README.rst b/README.rst index 2c9a798..c35fd18 100644 --- a/README.rst +++ b/README.rst @@ -84,6 +84,26 @@ You should be able to access the server at http://localhost:5000 (do not use file will not work. +Git Branches: +------------- + +This project has three principal git branches: + +* ``master``: this is the default branch in which development is done. It is the + branch from which releases are made. It is the branch feature branches are + branched from and get merged into. +* ``staging``: fedocal is deployed in the Fedora infrastructure in openshift + using s2i, the staging environment is built from this branch. This branch has + one extra commit that is not in ``master`` which adds all the files and changes + necessary to deploy fedocal in openshift using s2i. This branch is therefore + rebased and force-pushed when the staging fedocal instance is updated. + Pull-Request should not target this branch. +* ``production``: this branch is used for the same situation as the ``staging`` + branch but for the production fedocal instance. It also contains an additional + commit that is not in the ``master`` branch and is therefore force-pushed + after a rebase when the production fedocal instance is updated. + Pull-Request should not target this branch. + Testing: -------- From f7074bb546f40fd21729859ed18efa5b8107aba3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 4/14] Add missing dependency on email_validator --- diff --git a/requirements.txt b/requirements.txt index c27be35..8a0b996 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ # Use this file by running "$ pip install -r requirements.txt" alembic bleach +email_validator flask-wtf flask flask-babel From 577446af4389c13c2d9fddbebcc203c3576b9706 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 5/14] Add python 3.8 and 3.9 to the test matrix --- diff --git a/tox.ini b/tox.ini index 109f21e..d246a69 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py3{5,6,7} +envlist = py27,py3{5,6,7,8,9} # If the user is missing an interpreter, don't fail skip_missing_interpreters = True From 3b341938a5fcead5fac6e7f248624ea212936e4d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 6/14] Move from wtforms.validators.Required to DataRequired as per deprecation warning --- diff --git a/fedocal/forms.py b/fedocal/forms.py index 2725cec..001119c 100644 --- a/fedocal/forms.py +++ b/fedocal/forms.py @@ -81,16 +81,16 @@ class AddCalendarForm(i18nforms.Form): """ Form used to create a new calendar. """ calendar_name = wtforms.TextField( _('Calendar'), - [wtforms.validators.Required()]) + [wtforms.validators.DataRequired()]) calendar_contact = wtforms.TextField( _('Contact email'), - [wtforms.validators.Required()]) + [wtforms.validators.DataRequired()]) calendar_description = wtforms.TextField(_('Description')) calendar_editor_groups = wtforms.TextField(_('Editor groups')) calendar_admin_groups = wtforms.TextField(_('Admin groups')) calendar_status = wtforms.SelectField( _('Status'), - [wtforms.validators.Required()], + [wtforms.validators.DataRequired()], choices=[] ) @@ -123,16 +123,16 @@ class AddMeetingForm(i18nforms.Form): """ Form used to create a new meeting. """ calendar_name = wtforms.SelectField( _('Calendar'), - [wtforms.validators.Required()], + [wtforms.validators.DataRequired()], choices=[]) meeting_name = wtforms.TextField( _('Meeting name'), - [wtforms.validators.Required()]) + [wtforms.validators.DataRequired()]) meeting_date = wtforms.DateField( _('Date'), - [wtforms.validators.Required()]) + [wtforms.validators.DataRequired()]) meeting_date_end = wtforms.DateField( _('End date'), @@ -140,15 +140,15 @@ class AddMeetingForm(i18nforms.Form): meeting_time_start = wtforms.TextField( _('Start time'), - [wtforms.validators.Required(), validate_time]) + [wtforms.validators.DataRequired(), validate_time]) meeting_time_stop = wtforms.TextField( _('Stop time'), - [wtforms.validators.Required(), validate_time]) + [wtforms.validators.DataRequired(), validate_time]) meeting_timezone = wtforms.SelectField( _('Time zone'), - [wtforms.validators.Required()], + [wtforms.validators.DataRequired()], choices=[(tzone, tzone) for tzone in sorted(common_timezones)]) wiki_link = wtforms.TextField(_('More information URL')) @@ -272,4 +272,4 @@ class UploadIcsForm(i18nforms.Form): ''' Form to upload an ics file into a calendar. ''' ics_file = wtforms.FileField( _('ics file'), - [wtforms.validators.Required()]) + [wtforms.validators.DataRequired()]) From 6b7517764156e4ba9fdf7440baa59e40d02222c2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 7/14] Remove duplicate class for the error message --- diff --git a/fedocal/__init__.py b/fedocal/__init__.py index cfda2c9..1f75a3d 100644 --- a/fedocal/__init__.py +++ b/fedocal/__init__.py @@ -148,7 +148,6 @@ work. flask.flash( gettext('You must be in one more group than the CLA'), 'errors' - 'errors' ) return flask.redirect(flask.url_for('.index')) From 1a7dec9383e30a7525b27fe6531f859bc8eccb3d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 8/14] Add the test user to the signed_fpca group is cla is done --- diff --git a/tests/__init__.py b/tests/__init__.py index 295caec..7530801 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -140,6 +140,8 @@ class FakeUser(object): """ if isinstance(groups, six.string_types): groups = [groups] + if cla_done: + groups.append("signed_fpca") self.groups = groups self.username = username self.name = username From 4ef98450a79f73f14fae5e15cf924e4834d23755 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 9/14] Adjust the topic of the notification sent in the unit-tests --- diff --git a/tests/test_cron.py b/tests/test_cron.py index 23a5b46..834e119 100644 --- a/tests/test_cron.py +++ b/tests/test_cron.py @@ -182,7 +182,7 @@ class Crontests(Modeltests): self.assertNotEqual(obj, None) with testing.mock_sends(schema.ReminderV1( - topic="fedocal.reminder", + topic="fedocal.meeting.reminder", body={ 'meeting': { 'meeting_id': 1, @@ -246,7 +246,7 @@ class Crontests(Modeltests): self.assertNotEqual(obj, None) with testing.mock_sends(schema.ReminderV1( - topic="fedocal.reminder", + topic="fedocal.meeting.reminder", body={ 'meeting': { 'meeting_id': 1, From cf4c8b49b9b9bb54ef7f4c48b7f2721bc5be935c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:49 +0000 Subject: [PATCH 10/14] Remove test that no longer works For reasons that I do not understand this test no longer works. There should be an exception raised because the reminder_offset is not a valid value for the Enum field but somehow that exception isn't raised here. --- diff --git a/tests/test_reminder.py b/tests/test_reminder.py index 23ce5aa..e7bc36d 100644 --- a/tests/test_reminder.py +++ b/tests/test_reminder.py @@ -57,21 +57,6 @@ class Remindertests(Modeltests): self.session.commit() self.assertNotEqual(obj, None) - def test_init_reminder_failed(self): - """ Test the Reminder init function. """ - obj = model.Reminder( - 'H-36', - 'pingou@fp.o', - 'fi-apprentice@lists.fedoraproject.org,' - 'ambassadors@lists.fedoraproject.org', - 'This is your friendly reminder') - obj.save(self.session) - try: - self.session.flush() - except (IntegrityError, DataError): - obj = None - self.assertEqual(obj, None) - def test_repr_reminder(self): """ Test the Reminder string representation function. """ self.test_init_reminder() From 2fb333ed37432e15aa9d88bfd7bc6de4046e0fc2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:50 +0000 Subject: [PATCH 11/14] Drop python 2.7 from the test matrix Signed-off-by: Pierre-Yves Chibon --- diff --git a/tox.ini b/tox.ini index d246a69..c9501cf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py3{5,6,7,8,9} +envlist = py3{5,6,7,8,9} # If the user is missing an interpreter, don't fail skip_missing_interpreters = True From 8333bee1c0faa2ec1c278dcb62eb84f7920cb762 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:50 +0000 Subject: [PATCH 12/14] Stop using --no-use-pep517 when installing the dependencies in tox Signed-off-by: Pierre-Yves Chibon --- diff --git a/tox.ini b/tox.ini index c9501cf..8fc4d02 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ deps = pytest pytest-cov install_command = - pip install --no-use-pep517 {opts} {packages} + pip install {opts} {packages} setenv = FEDOCAL_CONFIG={toxinidir}/tests/fedocal_test.cfg PYTHONPATH={toxinidir} From 3cd89b67cc1bed77a7d6c45482ccba14f6b034a1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:50 +0000 Subject: [PATCH 13/14] Drop python 3.5 from the test matrix Signed-off-by: Pierre-Yves Chibon --- diff --git a/tox.ini b/tox.ini index 8fc4d02..121d70f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{5,6,7,8,9} +envlist = py3{6,7,8,9} # If the user is missing an interpreter, don't fail skip_missing_interpreters = True From 42ec7f7b68c51912527b9679b9a00bd49e0e34dc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 07 2021 07:24:50 +0000 Subject: [PATCH 14/14] Bump the requirement to fedocal-messaging 1.5.0+ Signed-off-by: Pierre-Yves Chibon --- diff --git a/requirements.txt b/requirements.txt index 8a0b996..982f127 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,4 +23,4 @@ flask_multistatic flask_oidc fedora-messaging email_validator -fedocal-messages>=1.4.0 +fedocal-messages>=1.5.0