Conversation
… its TestCase class. This allows GraphQL tests to make use of the stateful client methods like login()
|
|
||
| tc = TestClass() | ||
| tc._pre_setup() | ||
| tc.setUpClass() |
There was a problem hiding this comment.
I'm not sure why .setUpClass had to be called manually here but for same reason, ._pre_setup() should be called to. Otherwise, Django's TestCase doesn't populate TestCase.client.
| ) | ||
|
|
||
| @property | ||
| def _client(self): |
There was a problem hiding this comment.
Assuming people calling (get attribute) the client with _client in their tests, including myself, i didn't want to break all at once. But i'm not sure how to handle set attribute case, or does it even necessary.
f0de876 to
6b8a550
Compare
| @@ -0,0 +1,24 @@ | |||
| import pytest | |||
There was a problem hiding this comment.
Not the best file name obviously 🙃 I'm open for recommendations.
There was a problem hiding this comment.
Best I came up with is test_harness, which I didn't think is any better.
| @@ -0,0 +1,24 @@ | |||
| import pytest | |||
There was a problem hiding this comment.
Best I came up with is test_harness, which I didn't think is any better.
| ) | ||
|
|
||
| @property | ||
| def _client(self): |
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()
Updated version of #886, our oldest open PR.