summaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-21 20:25:00 -0700
committerAndrew Godwin2022-11-21 20:25:00 -0700
commita80e0f117a0271d428abd939e2896857a8da1b5c (patch)
treeec52ed0a24744207dca44af43a205d7c5f593c55 /tests/conftest.py
parent0d1e09fbcdb1a1db93d9561c9323c7ef105e71ca (diff)
downloadtakahe-a80e0f117a0271d428abd939e2896857a8da1b5c.tar.gz
takahe-a80e0f117a0271d428abd939e2896857a8da1b5c.tar.bz2
takahe-a80e0f117a0271d428abd939e2896857a8da1b5c.zip
Mentionify tests and some fixtures
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 79bdf60..24fac9a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,6 +1,7 @@
import pytest
from core.models import Config
+from users.models import Domain, Identity, User
@pytest.fixture
@@ -57,3 +58,37 @@ def config_system(keypair):
system_actor_public_key=keypair["public_key"],
)
yield Config.system
+
+
+@pytest.fixture
+@pytest.mark.django_db
+def identity():
+ """
+ Creates a basic test identity with a user and domain.
+ """
+ user = User.objects.create(email="test@example.com")
+ domain = Domain.objects.create(domain="example.com", local=True, public=True)
+ return Identity.objects.create(
+ actor_uri="https://example.com/test-actor/",
+ username="test",
+ domain=domain,
+ user=user,
+ name="Test User",
+ local=True,
+ )
+
+
+@pytest.fixture
+@pytest.mark.django_db
+def remote_identity():
+ """
+ Creates a basic remote test identity with a domain.
+ """
+ domain = Domain.objects.create(domain="remote.test", local=False)
+ return Identity.objects.create(
+ actor_uri="https://remote.test/test-actor/",
+ username="test",
+ domain=domain,
+ name="Test Remote User",
+ local=False,
+ )