ticketfrei3/backend/tests/tests_mastodon/conftest.py

33 lines
854 B
Python

# Copyright (C) 2020 by Cathy Hu <cathy.hu@fau.de>
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
#
# SPDX-License-Identifier: 0BSD
import pytest
from kibicara.model import Hood
from kibicara.platforms.mastodon.model import MastodonAccount, MastodonInstance
@pytest.fixture(scope="function")
@pytest.mark.anyio
async def mastodon_instance():
return await MastodonInstance.objects.create(
name="inst4nce",
client_id="cl13nt_id",
client_secret="cl13nt_s3cr3t",
)
@pytest.fixture(scope="function")
@pytest.mark.anyio
async def mastodon_account(hood_id, mastodon_instance):
hood = await Hood.objects.get(id=hood_id)
return await MastodonAccount.objects.create(
hood=hood,
instance=mastodon_instance,
access_token="t0k3n",
enabled=True,
username="us3r",
)