Closed sdobbelaere closed 9 months ago
Attention: 27 lines
in your changes are missing coverage. Please review.
Comparison is base (
c15a66e
) 88.00% compared to head (1bcbb67
) 87.39%. Report is 6 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@sdobbelaere I just solved the remaining pyright issues for you.
If the tests are passing fine, is there anything else missing from this or can it be merged?
@sdobbelaere I just solved the remaining pyright issues for you.
If the tests are passing fine, is there anything else missing from this or can it be merged?
Thank you for the help, much appreciated. The only thing left is commit b0a464a455afe3ca3f6fd27048d0e12a5c5c7a08 which allows you to manually set a user in the context for testing, on the condition that you mark it as "is_test_mode".
Why did I add this? Running tests needs access to a user in my case, this allows to construct a simple context when running tests like so:
from django.contrib.auth import get_user_model
from MyProject.schemas import schema
user = get_user_model().objects.last()
dummy_context = {'is_test_mode': True, 'user': user}
resp = schema.execute_sync(query=query, context_value=dummy_context)
Happy to add it to the docs.
@sdobbelaere I just solved the remaining pyright issues for you. If the tests are passing fine, is there anything else missing from this or can it be merged?
Thank you for the help, much appreciated. The only thing left is commit b0a464a which allows you to manually set a user in the context for testing, on the condition that you mark it as "is_test_mode".
Why did I add this? Running tests needs access to a user in my case, this allows to construct a simple context when running tests like so:
from django.contrib.auth import get_user_model from MyProject.schemas import schema user = get_user_model().objects.last() dummy_context = {'is_test_mode': True, 'user': user} resp = schema.execute_sync(query=query, context_value=dummy_context)
Happy to add it to the docs.
As I mentioned there, I don't like that approach very much, specially because we have a way for forcing a user into the request: https://github.com/strawberry-graphql/strawberry-graphql-django/blob/main/strawberry_django/test/client.py#L75
You can see it being used in here for example: https://github.com/strawberry-graphql/strawberry-graphql-django/blob/main/tests/test_permissions.py#L49
Just a small nitpick and it should be good to merge :)
Thanks for taking the time to adjust everything I asked
yw :)
As referred to in issue #375 some improved guidance on getting subscriptions running including the missing pieces related to the test-server.