Unit testing
Unit testing can be done by following the strawberryβs testing docs reference.
This lib also provides a TestClient
and an AsyncTestClient
that makes it easier
to run tests by mimicing a call to your API.
For example, suppose you have a me
query which returns the currently logged in
user or None
in case it is not authenticated. You could test it like this:
For more information how to apply these tests, take a look at the (source)[https://github.com/strawberry-graphql/strawberry-django/blob/main/strawberry_django/test/client.py ] and (this example)[https://github.com/strawberry-graphql/strawberry-django/blob/main/tests/test_permissions.py#L49 ]