Skip to content

Commit

Permalink
Fix bug in timeZone fields (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
allenporter authored May 20, 2022
1 parent 3abd8a6 commit 943ac90
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcal_sync/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Calendar(BaseModel):
summary: str = ""
description: Optional[str]
location: Optional[str]
timezone: Optional[str]
timezone: Optional[str] = Field(alias="timeZone")


class DateOrDatetime(BaseModel):
Expand Down
18 changes: 18 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ def test_calendar() -> None:
assert calendar.timezone is None


def test_calendar_timezone() -> None:
"""Exercise basic parsing of a calendar API response."""

calendar = Calendar.parse_obj(
{
"kind": "calendar#calendarListEntry",
"id": "some-calendar-id",
"summary": "Calendar summary",
"timeZone": "America/Los_Angeles",
}
)
assert calendar.id == "some-calendar-id"
assert calendar.summary == "Calendar summary"
assert calendar.description is None
assert calendar.location is None
assert calendar.timezone == "America/Los_Angeles"


def test_event_with_date() -> None:
"""Exercise basic parsing of an event API response."""

Expand Down

0 comments on commit 943ac90

Please sign in to comment.