2020-12-31 08:12:24 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from .. import GraphQLTestCase
|
|
|
|
from ...tests.test_types import with_local_registry
|
2022-09-26 01:56:22 +03:00
|
|
|
from ...settings import graphene_settings
|
2021-01-10 06:14:54 +03:00
|
|
|
from django.test import Client
|
2020-12-31 08:12:24 +03:00
|
|
|
|
|
|
|
|
|
|
|
@with_local_registry
|
2021-01-10 06:14:54 +03:00
|
|
|
def test_graphql_test_case_deprecated_client_getter():
|
2020-12-31 08:12:24 +03:00
|
|
|
"""
|
2021-01-10 06:14:54 +03:00
|
|
|
`GraphQLTestCase._client`' getter should raise pending deprecation warning.
|
2020-12-31 08:12:24 +03:00
|
|
|
"""
|
|
|
|
|
|
|
|
class TestClass(GraphQLTestCase):
|
|
|
|
GRAPHQL_SCHEMA = True
|
|
|
|
|
|
|
|
def runTest(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
tc = TestClass()
|
|
|
|
tc._pre_setup()
|
|
|
|
tc.setUpClass()
|
|
|
|
|
|
|
|
with pytest.warns(PendingDeprecationWarning):
|
|
|
|
tc._client
|
2021-01-10 06:14:54 +03:00
|
|
|
|
|
|
|
|
|
|
|
@with_local_registry
|
|
|
|
def test_graphql_test_case_deprecated_client_setter():
|
|
|
|
"""
|
|
|
|
`GraphQLTestCase._client`' setter should raise pending deprecation warning.
|
|
|
|
"""
|
|
|
|
|
|
|
|
class TestClass(GraphQLTestCase):
|
|
|
|
GRAPHQL_SCHEMA = True
|
|
|
|
|
|
|
|
def runTest(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
tc = TestClass()
|
|
|
|
tc._pre_setup()
|
|
|
|
tc.setUpClass()
|
|
|
|
|
|
|
|
with pytest.warns(PendingDeprecationWarning):
|
|
|
|
tc._client = Client()
|
2022-09-26 01:56:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
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
|