Skip to content

Commit

Permalink
Correct test_init_with_backend_online
Browse files Browse the repository at this point in the history
  • Loading branch information
FirelightFlagboy committed Nov 28, 2022
1 parent 5498a2b commit d8e9240
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions tests/core/backend_connection/test_authenticated_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,19 @@ async def alice_backend_conn(alice, event_bus_factory, running_backend_ready):


@pytest.mark.trio
@pytest.mark.parametrize("apiv22_organization_cmd_supported", (True, False))
async def test_init_with_backend_online(
running_backend, event_bus, alice, apiv22_organization_cmd_supported
):
async def test_init_with_backend_online(running_backend, event_bus, alice):
monitor_initialized = False
monitor_teardown = False

# Mock organization config command
async def _mocked_organization_config(client_ctx, msg):
if apiv22_organization_cmd_supported:
return {
"user_profile_outsider_allowed": True,
"active_users_limit": None,
"status": "ok",
}
else:
# Backend with API support <2.2, the client should be able to fallback
return {"status": "unknown_command"}
return {
"user_profile_outsider_allowed": True,
"active_users_limit": None,
"status": "ok",
"sequester_authority_certificate": None,
"sequester_services_certificates": None,
}

_mocked_organization_config._api_info = running_backend.backend.apis[ClientType.AUTHENTICATED][
"organization_config"
Expand Down Expand Up @@ -114,16 +109,12 @@ async def _monitor(
assert not monitor_teardown

# Test organization config retrieval
if apiv22_organization_cmd_supported:
assert conn.get_organization_config() == OrganizationConfig(
user_profile_outsider_allowed=True,
active_users_limit=None,
sequester_authority=None,
sequester_services=None,
)
else:
# Default value
assert conn.get_organization_config() == default_organization_config
assert conn.get_organization_config() == OrganizationConfig(
user_profile_outsider_allowed=True,
active_users_limit=None,
sequester_authority=None,
sequester_services=None,
)

# Test command
rep = await conn.cmds.ping("foo")
Expand Down

0 comments on commit d8e9240

Please sign in to comment.