From 9ad9bdd9363dedf50ab3fbe70375bd817f92512b Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 15 Dec 2022 15:55:33 -0700 Subject: Implement post rate limits, move to signed cookies Also improve the test harness a little Fixes #112 --- tests/conftest.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index 9127466..a86f2f3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ import time import pytest +from django.conf import settings from activities.models import Emoji from api.models import Application, Token @@ -73,6 +74,19 @@ def config_system(keypair): del Config.system +@pytest.fixture +def client_with_identity(client, identity, user): + """ + Provides a logged-in test client with an identity selected + """ + client.force_login(user) + session = client.session + session["identity_id"] = identity.id + session.save() + client.cookies[settings.SESSION_COOKIE_NAME] = session.session_key + return client + + @pytest.fixture @pytest.mark.django_db def emoji_locals(): -- cgit v1.2.3