Skip to content

Commit

Permalink
Add test_invited_invite_info_ok_with_shamir test
Browse files Browse the repository at this point in the history
  • Loading branch information
vxgmichel committed Nov 21, 2024
1 parent 9ee3668 commit 3acd5a9
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions server/tests/api_v4/invited/test_invite_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import pytest

from parsec._parsec import invited_cmds
from tests.common import CoolorgRpcClients, HttpCommonErrorsTester
from parsec._parsec import authenticated_cmds, invited_cmds
from tests.common import CoolorgRpcClients, HttpCommonErrorsTester, ShamirOrgRpcClients
from tests.common.client import InvitedRpcClient


@pytest.mark.parametrize("user_or_device", ("user", "device"))
Expand Down Expand Up @@ -32,6 +33,40 @@ async def test_invited_invite_info_ok(user_or_device: str, coolorg: CoolorgRpcCl
assert False, unknown


async def test_invited_invite_info_ok_with_shamir(shamirorg: ShamirOrgRpcClients) -> None:
# TODO: add `TestbedEventNewShamirRecoveryInvitation` event
rep = await shamirorg.bob.invite_new_shamir_recovery(
send_email=False,
claimer_user_id=shamirorg.alice.user_id,
)
assert isinstance(rep, authenticated_cmds.v4.invite_new_shamir_recovery.RepOk)

shamir_invited_bob = InvitedRpcClient(shamirorg.raw_client, shamirorg.organization_id, rep) # type: ignore
rep = await shamir_invited_bob.invite_info()
assert rep == invited_cmds.v4.invite_info.RepOk(
invited_cmds.v4.invite_info.UserOrDeviceShamirRecovery(
threshold=2,
recipients=[
invited_cmds.latest.invite_info.ShamirRecoveryRecipient(
user_id=shamirorg.bob.user_id,
human_handle=shamirorg.bob.human_handle,
shares=2,
),
invited_cmds.latest.invite_info.ShamirRecoveryRecipient(
user_id=shamirorg.mallory.user_id,
human_handle=shamirorg.mallory.human_handle,
shares=1,
),
invited_cmds.latest.invite_info.ShamirRecoveryRecipient(
user_id=shamirorg.mike.user_id,
human_handle=shamirorg.mike.human_handle,
shares=1,
),
],
)
)


async def test_invited_invite_info_http_common_errors(
coolorg: CoolorgRpcClients, invited_http_common_errors_tester: HttpCommonErrorsTester
) -> None:
Expand Down

0 comments on commit 3acd5a9

Please sign in to comment.