diff --git a/spond_classes/event.py b/spond_classes/event.py index d6bb2fd..cab558e 100644 --- a/spond_classes/event.py +++ b/spond_classes/event.py @@ -41,16 +41,16 @@ class Event(BaseModel): heading : str Heading/name of the Event. `heading` in API. + responses : Responses start_time : datetime. Datetime at which the Event starts. `startTimestamp` in API, but returns a datetime instead of a string. - responses : Responses """ uid: str = Field(alias="id") heading: str - start_time: datetime = Field(alias="startTimestamp") responses: Responses + start_time: datetime = Field(alias="startTimestamp") def __str__(self) -> str: """Return simple human-readable description. diff --git a/tests/conftest.py b/tests/conftest.py index 8a66684..16c8947 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -93,7 +93,6 @@ def member_with_profile_data() -> dict: def simple_group_data() -> dict: """Represent the simplest possible Group in this implementation. - For testing Event in isolation. Item from 'groups' (root). """ return { @@ -157,7 +156,6 @@ def complex_group_data() -> dict: def simple_event_data() -> dict: """Represent the simplest possible Event in this implementation. - For testing Event in isolation. Item from 'events' (root). """ return { @@ -184,7 +182,6 @@ def complex_event_data() -> dict: return { "id": "36D7F1A46EB2CDED4B6F22D400229822", "heading": "Event 2", - "startTimestamp": "2022-11-04T06:00:00Z", "responses": { "acceptedIds": [ "B24FA75A4CCBC63199A57361E88B0646", @@ -207,4 +204,5 @@ def complex_event_data() -> dict: "49C2447E4ADE8005A9652B24F95E4F6F", ], }, + "startTimestamp": "2022-11-04T06:00:00Z", } diff --git a/tests/test_event.py b/tests/test_event.py index ba65544..d72ddfe 100644 --- a/tests/test_event.py +++ b/tests/test_event.py @@ -2,7 +2,7 @@ from datetime import datetime, timezone -from spond_classes import Event +from spond_classes.event import Event def test_from_dict_simple(simple_event_data: dict) -> None: @@ -14,12 +14,12 @@ def test_from_dict_simple(simple_event_data: dict) -> None: assert my_event.uid == "A390CE5396D2F5C3015F53E171EC59D5" assert my_event.heading == "Event 1" - assert my_event.start_time == datetime(2021, 7, 6, 6, 0, tzinfo=timezone.utc) assert my_event.responses.accepted_uids == [] assert my_event.responses.declined_uids == [] assert my_event.responses.unanswered_uids == [] assert my_event.responses.waiting_list_uids == [] assert my_event.responses.unconfirmed_uids == [] + assert my_event.start_time == datetime(2021, 7, 6, 6, 0, tzinfo=timezone.utc) assert str(my_event) == "Event 'Event 1' on 2021-07-06" @@ -32,7 +32,6 @@ def test_from_dict_complex(complex_event_data: dict) -> None: assert my_event.uid == "36D7F1A46EB2CDED4B6F22D400229822" assert my_event.heading == "Event 2" - assert my_event.start_time == datetime(2022, 11, 4, 6, 0, tzinfo=timezone.utc) assert my_event.responses.accepted_uids == [ "B24FA75A4CCBC63199A57361E88B0646", "C7BCC3B8A95DCF82DFFD27B2B30C8FA2", @@ -53,4 +52,5 @@ def test_from_dict_complex(complex_event_data: dict) -> None: "2D1BB37608F09511FD5F280D219DFD97", "49C2447E4ADE8005A9652B24F95E4F6F", ] + assert my_event.start_time == datetime(2022, 11, 4, 6, 0, tzinfo=timezone.utc) assert str(my_event) == "Event 'Event 2' on 2022-11-04" diff --git a/tests/test_group.py b/tests/test_group.py index ab004e9..085f370 100644 --- a/tests/test_group.py +++ b/tests/test_group.py @@ -1,6 +1,6 @@ """Tests for Group class.""" -from spond_classes import Group +from spond_classes.group import Group def test_from_dict_simple(simple_group_data: dict) -> None: