feat: initial commit
This commit is contained in:
commit
e8291f4bef
33 changed files with 10300 additions and 0 deletions
54
tests/unit/test_service.py
Normal file
54
tests/unit/test_service.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import pytest
|
||||
|
||||
from secretsanta.service import participants2url
|
||||
|
||||
pytestmark = pytest.mark.anyio
|
||||
|
||||
|
||||
async def test_create_group_service(create_group_service, group, config):
|
||||
participants = await create_group_service.run(group)
|
||||
assert (
|
||||
participants2url(
|
||||
participants=group.participants,
|
||||
group_uuid=group.uuid,
|
||||
server_url=config.server_url,
|
||||
)
|
||||
== participants
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("repo_with_data")
|
||||
async def test_create_group_service_returns_existing_group(create_group_service, group, config, group_factory):
|
||||
new_group = group_factory.build()
|
||||
new_group.uuid = group.uuid
|
||||
assert new_group != group
|
||||
participants = await create_group_service.run(new_group)
|
||||
assert (
|
||||
participants2url(
|
||||
participants=group.participants,
|
||||
group_uuid=group.uuid,
|
||||
server_url=config.server_url,
|
||||
)
|
||||
== participants
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("repo_with_data")
|
||||
async def test_get_participants(get_participants_service, group, config):
|
||||
participants = await get_participants_service.run(group.uuid)
|
||||
assert (
|
||||
participants2url(
|
||||
participants=group.participants,
|
||||
group_uuid=group.uuid,
|
||||
server_url=config.server_url,
|
||||
)
|
||||
== participants
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("repo_with_data")
|
||||
async def test_get_pair(get_pair_service, group):
|
||||
assert group.pairs
|
||||
for gifter, giftee in group.pairs.items():
|
||||
pair = await get_pair_service.run(group.uuid, gifter)
|
||||
assert pair == giftee
|
||||
Loading…
Add table
Add a link
Reference in a new issue