ticketfrei3/backend/tests/tests_mastodon/conftest.py

34 lines
885 B
Python
Raw Normal View History

2023-03-19 12:47:20 +00:00
# Copyright (C) 2020 by Cathy Hu <cathy.hu@fau.de>
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
2023-03-19 18:03:25 +00:00
# Copyright (C) 2023 by Thomas Lindner <tom@dl6tom.de>
2023-03-19 12:47:20 +00:00
#
# SPDX-License-Identifier: 0BSD
2023-04-01 13:13:50 +00:00
import pytest
2023-03-19 12:47:20 +00:00
from kibicara.model import Hood
from kibicara.platforms.mastodon.model import MastodonAccount, MastodonInstance
2023-04-01 13:13:50 +00:00
@pytest.fixture(scope="function")
@pytest.mark.anyio
async def mastodon_instance():
2023-03-19 18:03:25 +00:00
return await MastodonInstance.create(
2023-04-01 13:13:50 +00:00
name="inst4nce",
client_id="cl13nt_id",
client_secret="cl13nt_s3cr3t",
2023-03-19 12:47:20 +00:00
)
2023-04-01 13:13:50 +00:00
@pytest.fixture(scope="function")
@pytest.mark.anyio
async def mastodon_account(hood_id, mastodon_instance):
2023-03-19 18:03:25 +00:00
hood = await Hood.get(id=hood_id)
return await MastodonAccount.create(
2023-04-01 13:13:50 +00:00
hood=hood,
instance=mastodon_instance,
access_token="t0k3n",
enabled=True,
username="us3r",
2023-03-19 12:47:20 +00:00
)