Skip to content

Commit

Permalink
isort and black
Browse files Browse the repository at this point in the history
  • Loading branch information
fretchen committed Aug 13, 2024
1 parent 342b9c3 commit fe929ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/qlued/api_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
as they are test systems.
"""


from decouple import config
from django.http import HttpRequest, HttpResponse
from dropbox.exceptions import ApiError, AuthError
from ninja import NinjaAPI
from ninja.security import HttpBearer
from ninja.responses import codes_4xx
from ninja.security import HttpBearer
from sqooler.schemes import (
BackendConfigSchemaOut,
BackendStatusSchemaOut,
Expand All @@ -24,8 +24,6 @@
get_init_status,
)

from django.http import HttpRequest, HttpResponse

from .models import StorageProviderDb, Token
from .schemas import DictSchema
from .storage_providers import (
Expand All @@ -34,7 +32,6 @@
get_storage_provider_from_entry,
)


api = NinjaAPI(version="3.0.0")


Expand All @@ -43,6 +40,7 @@ class InvalidToken(Exception):
Exception that is raised when the access token is invalid.
"""


@api.exception_handler(InvalidToken)
def on_invalid_token(request: HttpRequest, exc: Exception) -> HttpResponse:
"""
Expand All @@ -67,6 +65,7 @@ class AuthBearer(HttpBearer):
"""
Class that handles authentification through a token.
"""

# pylint: disable=R0903
def authenticate(self, request: HttpRequest, token: str) -> str:

Expand Down
6 changes: 4 additions & 2 deletions tests/test_api_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

User = get_user_model()


class BackendConfigTest(TestCase):
"""
The class that contains all the tests for this backends app.
Expand Down Expand Up @@ -250,7 +251,8 @@ def test_get_job_status_ninja(self):

req_id = data["job_id"]
url = reverse_lazy(
"api-3.0.0:get_job_status", kwargs={"backend_name": "fermions"},
"api-3.0.0:get_job_status",
kwargs={"backend_name": "fermions"},
)

# test what happens with a non confirmed job and something that is non existent
Expand All @@ -265,7 +267,7 @@ def test_get_job_status_ninja(self):
# test what happens with a no job is provided
req = self.client.get(
url,
token = self.token.key,
token=self.token.key,
HTTP_AUTHORIZATION=f"Bearer {self.token.key}",
)
data = json.loads(req.content)
Expand Down

0 comments on commit fe929ed

Please sign in to comment.