summaryrefslogtreecommitdiffstats
path: root/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 283de76..f2b9d64 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,6 +2,7 @@ import time
import pytest
+from api.models import Application, Token
from core.models import Config
from stator.runner import StatorModel, StatorRunner
from users.models import Domain, Identity, User
@@ -172,6 +173,26 @@ def remote_identity2() -> Identity:
@pytest.fixture
+@pytest.mark.django_db
+def api_token(identity) -> Token:
+ """
+ Creates an API application, an identity, and a token for that identity
+ """
+ application = Application.objects.create(
+ name="Test App",
+ client_id="tk-test",
+ client_secret="mytestappsecret",
+ )
+ return Token.objects.create(
+ application=application,
+ user=identity.users.first(),
+ identity=identity,
+ token="mytestapitoken",
+ scopes=["read", "write", "follow", "push"],
+ )
+
+
+@pytest.fixture
def stator(config_system) -> StatorRunner:
"""
Return an initialized StatorRunner for tests that need state transitioning