Skip to content

Commit

Permalink
Force PST in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OneBlue committed Nov 2, 2024
1 parent ec80fef commit cd3bf69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def get_event_fields(event):
if 'dtstart' in component:
start = component['dtstart'].dt
event['start'] = format_time(start)

if not isinstance(start, datetime):
start = datetime.combine(start, datetime.min.time())

Expand Down Expand Up @@ -149,7 +148,7 @@ def render_event(collection_id, event_id, event_data, **extra_fields):
fields = get_event_fields(event_data)
fields['collection'] = collection_id
fields['event'] = event_id
fields['server_timezone'] = get_localzone().zone
fields['server_timezone'] = settings.timezone.zone
add_request_auth(fields)

for e in extra_fields:
Expand Down
6 changes: 5 additions & 1 deletion events/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest
import json
import pytz
import time
import email
from threading import Thread
from ecdsa import SigningKey
Expand All @@ -19,6 +20,9 @@
from flask.testing import FlaskClient as BaseFlaskClient


os.environ['TZ'] = 'America/Los_Angeles'
time.tzset()

event_1 = Event()
event_1.add('dtstart', datetime(2010, 10, 10, 10, 0, 0))
event_1['summary'] = 'event_1'
Expand Down Expand Up @@ -144,7 +148,7 @@ class Config:

external_url = 'http://127.0.0.1:1111'
signing_key = SigningKey.generate()
timezone = pytz.timezone('US/Pacific')
timezone = pytz.timezone(os.environ['TZ'])

def is_admin(self, request):
return request.headers.get('X-Admin', None) == 'true'
Expand Down

0 comments on commit cd3bf69

Please sign in to comment.