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>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: 0BSD
|
|
|
|
|
|
|
|
from pytest import fixture
|
|
|
|
|
|
|
|
from kibicara.model import Hood
|
|
|
|
from kibicara.platforms.mastodon.model import MastodonAccount, MastodonInstance
|
|
|
|
|
|
|
|
|
2023-03-19 13:04:45 +00:00
|
|
|
@fixture(scope="function")
|
2023-03-19 16:25:37 +00:00
|
|
|
def mastodon_instance(event_loop):
|
|
|
|
return event_loop.run_until_complete(
|
2023-03-19 12:47:20 +00:00
|
|
|
MastodonInstance.objects.create(
|
|
|
|
name="inst4nce",
|
|
|
|
client_id="cl13nt_id",
|
|
|
|
client_secret="cl13nt_s3cr3t",
|
|
|
|
)
|
|
|
|
)
|
2023-03-19 16:25:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
@fixture(scope="function")
|
|
|
|
def mastodon_account(event_loop, hood_id, mastodon_instance):
|
|
|
|
hood = event_loop.run_until_complete(Hood.objects.get(id=hood_id))
|
2023-03-19 12:47:20 +00:00
|
|
|
return event_loop.run_until_complete(
|
|
|
|
MastodonAccount.objects.create(
|
|
|
|
hood=hood,
|
2023-03-19 16:25:37 +00:00
|
|
|
instance=mastodon_instance,
|
2023-03-19 12:47:20 +00:00
|
|
|
access_token="t0k3n",
|
|
|
|
enabled=True,
|
|
|
|
username="us3r",
|
|
|
|
)
|
|
|
|
)
|