Я пытаюсь проверить, не прошла ли моя аутентификация. Исключение возникает, но не перехватывается assertRaises
. Что мне здесь не хватает?
def test_auth(self):
from graphql_jwt.exceptions import PermissionDenied
with self.assertRaises(PermissionDenied):
response = self.client.execute(self.query)
Traceback:
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
Traceback (most recent call last):
File "/home/dan/game/venv/lib/python3.7/site-packages/promise/promise.py", line 487, in _resolve_from_executor
executor(resolve, reject)
File "/home/dan/game/venv/lib/python3.7/site-packages/promise/promise.py", line 754, in executor
return resolve(f(*args, **kwargs))
File "/home/dan/game/venv/lib/python3.7/site-packages/graphql/execution/middleware.py", line 75, in make_it_promise
return next(*args, **kwargs)
File "/home/dan/game/venv/lib/python3.7/site-packages/graphene_django/filter/fields.py", line 106, in connection_resolver
**args
File "/home/dan/game/venv/lib/python3.7/site-packages/graphene_django/fields.py", line 156, in connection_resolver
iterable = resolver(root, info, **args)
File "/home/dan/game/venv/lib/python3.7/site-packages/graphql_jwt/decorators.py", line 31, in wrapper
return func(info.context, *args, **kwargs)
File "/home/dan/game/venv/lib/python3.7/site-packages/graphql_jwt/decorators.py", line 43, in wrapper
raise exceptions.PermissionDenied()
graphql.error.located_error.GraphQLLocatedError: You do not have permission to perform this action
F.
======================================================================
FAIL: test_auth (api.tests.test_mutations.TestGame)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/dan/game/api/tests/test_mutations.py", line 57, in test_auth
response = self.client.execute(self.query)
AssertionError: PermissionDenied not raised
Возникает исключение здесь .