File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ def query(
101101 )
102102
103103 @property
104+ def _client (self ):
105+ pass
106+
107+ @_client .getter
104108 def _client (self ):
105109 warnings .warn (
106110 "Using `_client` is deprecated in favour of `client`." ,
@@ -109,6 +113,15 @@ def _client(self):
109113 )
110114 return self .client
111115
116+ @_client .setter
117+ def _client (self , client ):
118+ warnings .warn (
119+ "Using `_client` is deprecated in favour of `client`." ,
120+ PendingDeprecationWarning ,
121+ stacklevel = 2 ,
122+ )
123+ self .client = client
124+
112125 def assertResponseNoErrors (self , resp , msg = None ):
113126 """
114127 Assert that the call went through correctly. 200 means the syntax is ok, if there are no `errors`,
Original file line number Diff line number Diff line change 22
33from .. import GraphQLTestCase
44from ...tests .test_types import with_local_registry
5+ from django .test import Client
56
67
78@with_local_registry
8- def test_graphql_test_case_deprecated_client ():
9+ def test_graphql_test_case_deprecated_client_getter ():
910 """
10- Test that `GraphQLTestCase._client`'s should raise pending deprecation warning.
11+ `GraphQLTestCase._client`' getter should raise pending deprecation warning.
1112 """
1213
1314 class TestClass (GraphQLTestCase ):
@@ -22,3 +23,23 @@ def runTest(self):
2223
2324 with pytest .warns (PendingDeprecationWarning ):
2425 tc ._client
26+
27+
28+ @with_local_registry
29+ def test_graphql_test_case_deprecated_client_setter ():
30+ """
31+ `GraphQLTestCase._client`' setter should raise pending deprecation warning.
32+ """
33+
34+ class TestClass (GraphQLTestCase ):
35+ GRAPHQL_SCHEMA = True
36+
37+ def runTest (self ):
38+ pass
39+
40+ tc = TestClass ()
41+ tc ._pre_setup ()
42+ tc .setUpClass ()
43+
44+ with pytest .warns (PendingDeprecationWarning ):
45+ tc ._client = Client ()
You can’t perform that action at this time.
0 commit comments