Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend tests #149

Merged
merged 7 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ __pycache__
Procfile
architecture.svg
app.json
features
7 changes: 6 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10"]
tox_env: ["py"]
# see https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
include:
- python: "3.9"
tox_env: web

steps:
- uses: actions/checkout@v3
Expand All @@ -23,4 +28,4 @@ jobs:
run: pip install tox
- name: Run tests
# Run tox using the version of Python in `PATH`
run: tox -e py
run: tox -e ${{ matrix.tox_env }}
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,8 @@ def unhandledException(error):
</html>
""".format(traceback=file.getvalue()), 500 # return error code from https://stackoverflow.com/a/7824605

# make serializable for multiprocessing
#app.__reduce__ = lambda: __name__ + ".app"

if __name__ == "__main__":
app.run(debug=DEBUG, host="0.0.0.0", port=PORT)
4 changes: 3 additions & 1 deletion convert_to_dhtmlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from conversion_base import ConversionStrategy
import recurring_ical_events
from pprint import pprint
from dateutil.parser import parse as parse_date


class ConvertToDhtmlx(ConversionStrategy):
Expand Down Expand Up @@ -91,7 +92,8 @@ def merge(self):
return jsonify(self.components)

def collect_components_from(self, calendars):
today = datetime.datetime.utcnow()
# see https://stackoverflow.com/a/16115575/1320237
today = (parse_date(self.specification["date"]) if "date" in self.specification else datetime.datetime.utcnow())
one_year_ahead = today.replace(year=today.year + 1)
one_year_before = today.replace(year=today.year - 1)
for calendar in calendars:
Expand Down
5 changes: 5 additions & 0 deletions default_specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ controls:
## You can describe the calendar with a text so people know what it is about.
description: "This is a calendar which provides a website and an ICS subscription link based on the different calendars it is configured to use."

## You can set the date that the calendar displays
#date: "2023-1-23"
#date: "2023-1-23 13:00"
date: ""

###################### You will probably not change this. ######################
##
## The template is the file which shows the calendar.
Expand Down
6 changes: 6 additions & 0 deletions features/calendar.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: displaying calendar files

Scenario: show a calendar with one event
Given we add the calendar "one-event"
When we look at 2019-03-04
Then we see 1 event
34 changes: 34 additions & 0 deletions features/calendars/one-event.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SabreDAV//SabreDAV//EN
CALSCALE:GREGORIAN
X-WR-CALNAME:test
X-APPLE-CALENDAR-COLOR:#e78074
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20190303T111937
DTSTAMP:20190303T111937
LAST-MODIFIED:20190303T111937
UID:UYDQSG9TH4DE0WM3QFL2J
SUMMARY:test1
DTSTART;TZID=Europe/Berlin:20190304T080000
DTEND;TZID=Europe/Berlin:20190304T083000
END:VEVENT
END:VCALENDAR
Loading