File tree 2 files changed +36
-2
lines changed
2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ def query(
101
101
)
102
102
103
103
@property
104
+ def _client (self ):
105
+ pass
106
+
107
+ @_client .getter
104
108
def _client (self ):
105
109
warnings .warn (
106
110
"Using `_client` is deprecated in favour of `client`." ,
@@ -109,6 +113,15 @@ def _client(self):
109
113
)
110
114
return self .client
111
115
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
+
112
125
def assertResponseNoErrors (self , resp , msg = None ):
113
126
"""
114
127
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 2
2
3
3
from .. import GraphQLTestCase
4
4
from ...tests .test_types import with_local_registry
5
+ from django .test import Client
5
6
6
7
7
8
@with_local_registry
8
- def test_graphql_test_case_deprecated_client ():
9
+ def test_graphql_test_case_deprecated_client_getter ():
9
10
"""
10
- Test that `GraphQLTestCase._client`'s should raise pending deprecation warning.
11
+ `GraphQLTestCase._client`' getter should raise pending deprecation warning.
11
12
"""
12
13
13
14
class TestClass (GraphQLTestCase ):
@@ -22,3 +23,23 @@ def runTest(self):
22
23
23
24
with pytest .warns (PendingDeprecationWarning ):
24
25
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