Skip to content

Commit

Permalink
Add a test for APIEventOrganizationConfig.sse_keepalive python conver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
vxgmichel committed Feb 15, 2025
1 parent 197255d commit b626203
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion server/tests/test_sse.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def test_missed_events(minimalorg: MinimalorgRpcClients, backend: Backend)
)
)

# First event is always ServiceConfig
# First event is always OrganizationConfig
event = await alice_sse.next_event()
assert event == authenticated_cmds.latest.events_listen.RepOk(
authenticated_cmds.latest.events_listen.APIEventOrganizationConfig(
Expand All @@ -78,6 +78,16 @@ async def test_missed_events(minimalorg: MinimalorgRpcClients, backend: Backend)
)
)

# Check field conversions
assert isinstance(event, authenticated_cmds.latest.events_listen.RepOk)
inner_event = event.unit
assert isinstance(
inner_event, authenticated_cmds.latest.events_listen.APIEventOrganizationConfig
)
assert inner_event.active_users_limit == ActiveUsersLimit.NO_LIMIT
assert inner_event.user_profile_outsider_allowed is True
assert inner_event.sse_keepalive == 30.0

# Backend should inform that some events were missed and we could not retrieve them
event = await anext(alice_sse._iter_events)
assert event.event == "missed_events"
Expand Down

0 comments on commit b626203

Please sign in to comment.