From dd354648f8be6a59ff29144da93bf76616750f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Ma=C3=AFzi?= Date: Fri, 3 Jul 2020 11:42:10 +0200 Subject: [PATCH] [WIP] Pb import halfapi dans test_jwt_middleware. --- halfapi/lib/__init__.py | 0 halfapi/lib/jwt_middleware.py | 1 - halfapi/lib/query.py | 2 +- pytest.ini | 4 ++++ tests/test_jwt_middleware.py | 7 +++++++ 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 halfapi/lib/__init__.py create mode 100644 pytest.ini create mode 100644 tests/test_jwt_middleware.py diff --git a/halfapi/lib/__init__.py b/halfapi/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/halfapi/lib/jwt_middleware.py b/halfapi/lib/jwt_middleware.py index b4a2be2..434083f 100644 --- a/halfapi/lib/jwt_middleware.py +++ b/halfapi/lib/jwt_middleware.py @@ -53,7 +53,6 @@ class JWTUser(BaseUser): class JWTAuthenticationBackend(AuthenticationBackend): - def __init__(self, secret_key: str, algorithm: str = 'HS256', prefix: str = 'JWT', name: str = 'name'): self.secret_key = secret_key self.algorithm = algorithm diff --git a/halfapi/lib/query.py b/halfapi/lib/query.py index f658aec..b739916 100644 --- a/halfapi/lib/query.py +++ b/halfapi/lib/query.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 from starlette.exceptions import HTTPException -from halfapi.lib.responses import CSVResponse +from .responses import CSVResponse """ This is the *query* library that contains all the useful functions to treat our diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..25c7847 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +testpaths = tests halfapi +addopts = --doctest-modules +doctest_optionflags = ELLIPSIS diff --git a/tests/test_jwt_middleware.py b/tests/test_jwt_middleware.py new file mode 100644 index 0000000..22e12cc --- /dev/null +++ b/tests/test_jwt_middleware.py @@ -0,0 +1,7 @@ +import jwt +from halfapi import app + +def coucou(): + return +def test_connected(): + app.route('/', coucou)