diff --git a/graphene_django/settings.py b/graphene_django/settings.py index c487123..fbdc61f 100644 --- a/graphene_django/settings.py +++ b/graphene_django/settings.py @@ -45,6 +45,7 @@ DEFAULTS = { # https://github.com/graphql/graphiql/tree/main/packages/graphiql#options "GRAPHIQL_HEADER_EDITOR_ENABLED": True, "ATOMIC_MUTATIONS": False, + "TESTING_ENDPOINT": "/graphql" } if settings.DEBUG: diff --git a/graphene_django/utils/testing.py b/graphene_django/utils/testing.py index 584a08b..84a8c1a 100644 --- a/graphene_django/utils/testing.py +++ b/graphene_django/utils/testing.py @@ -3,7 +3,7 @@ import warnings from django.test import Client, TestCase -DEFAULT_GRAPHQL_URL = "/graphql/" +from graphene_django.settings import graphene_settings def graphql_query( @@ -38,7 +38,7 @@ def graphql_query( if client is None: client = Client() if not graphql_url: - graphql_url = DEFAULT_GRAPHQL_URL + graphql_url = graphene_settings.TESTING_ENDPOINT body = {"query": query} if operation_name: @@ -67,7 +67,7 @@ class GraphQLTestCase(TestCase): """ # URL to graphql endpoint - GRAPHQL_URL = DEFAULT_GRAPHQL_URL + GRAPHQL_URL = graphene_settings.TESTING_ENDPOINT def query( self, query, operation_name=None, input_data=None, variables=None, headers=None diff --git a/graphene_django/utils/tests/test_testing.py b/graphene_django/utils/tests/test_testing.py index 2ef78f9..a03c8a7 100644 --- a/graphene_django/utils/tests/test_testing.py +++ b/graphene_django/utils/tests/test_testing.py @@ -2,9 +2,9 @@ import pytest from .. import GraphQLTestCase from ...tests.test_types import with_local_registry +from ...settings import graphene_settings from django.test import Client - @with_local_registry def test_graphql_test_case_deprecated_client_getter(): """ @@ -43,3 +43,15 @@ def test_graphql_test_case_deprecated_client_setter(): with pytest.warns(PendingDeprecationWarning): tc._client = Client() + + +def test_graphql_test_case_imports_endpoint(): + """ + GraphQLTestCase class should import the default endpoint from settings file + """ + + assert GraphQLTestCase.GRAPHQL_URL == graphene_settings.TESTING_ENDPOINT + + + +