schon/engine/core/tests/test_graphene.py
Egor fureunoir Gorbunov 1ecd784b4e Features: 1) Add setup for generating authorization tokens in DRFCoreViewsTests; 2) Simplify user handling in JWT mutations using validated serializer data.
Fixes: 1) Correct redundant user lookup in JWT mutations.

Extra: 1) Add TODO comments for HTTP method tests in both DRF and Graphene test modules; 2) Minor cleanup in test files.
2025-11-14 17:21:39 +03:00

18 lines
628 B
Python

from typing import Any
from django.test import TestCase
from django.urls import reverse
class GraphQLCoreTests(TestCase):
def graphql(self, query: str, variables: dict | None = None):
url = reverse("graphql-platform")
payload: dict[str, Any] = {"query": query}
if variables:
payload["variables"] = variables
response = self.client.post(url, data=payload, content_type="application/json")
self.assertEqual(response.status_code, 200, response.json())
return response.json()
# TODO: create tests for every possible HTTP method in core module with Graphene stack