-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the Django TestCase's Client (#1084)
* Use the Django Client test utility instance that Django provides with its TestCase class. This allows GraphQL tests to make use of the stateful client methods like login() * Add missing test case initializer call * Don't break backward compability * Add test for pending deprecation warning on GraphQLTestCase._client Co-authored-by: Tom Nightingale <tom@tnightingale.com>
- Loading branch information
1 parent
8c48516
commit 40e5252
Showing
3 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
|
||
from .. import GraphQLTestCase | ||
from ...tests.test_types import with_local_registry | ||
|
||
|
||
@with_local_registry | ||
def test_graphql_test_case_deprecated_client(): | ||
""" | ||
Test that `GraphQLTestCase._client`'s 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 |