Skip to content

Commit 76d2839

Browse files
committed
Fixed tests
1 parent a694bc0 commit 76d2839

File tree

19 files changed

+89
-144
lines changed

19 files changed

+89
-144
lines changed

src/graphql_server/__init__.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
GraphQL-Server
1+
"""GraphQL-Server
32
===================
43
54
GraphQL-Server is a base library that serves as a helper
@@ -10,10 +9,10 @@
109
from .runtime import (
1110
execute,
1211
execute_sync,
12+
introspect,
13+
process_errors,
1314
subscribe,
1415
validate_document,
15-
process_errors,
16-
introspect,
1716
)
1817
from .version import version, version_info
1918

@@ -23,12 +22,12 @@
2322
__version_info__ = version_info
2423

2524
__all__ = [
26-
"version",
27-
"version_info",
2825
"execute",
2926
"execute_sync",
27+
"introspect",
28+
"process_errors",
3029
"subscribe",
3130
"validate_document",
32-
"process_errors",
33-
"introspect",
31+
"version",
32+
"version_info",
3433
]

src/graphql_server/aiohttp/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from aiohttp import http, web
1919
from aiohttp.multipart import BodyPartReader
20+
from graphql_server.http import GraphQLRequestData
2021
from graphql_server.http.async_base_view import (
2122
AsyncBaseHTTPView,
2223
AsyncHTTPRequestAdapter,
@@ -28,7 +29,6 @@
2829
NonTextMessageReceived,
2930
WebSocketDisconnected,
3031
)
31-
from graphql_server.http import GraphQLRequestData
3232
from graphql_server.http.types import FormData, HTTPMethod, QueryParams
3333
from graphql_server.http.typevars import (
3434
Context,

src/graphql_server/channels/handlers/http_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
from channels.db import database_sync_to_async
2323
from channels.generic.http import AsyncHttpConsumer
24+
from graphql_server.http import GraphQLRequestData
2425
from graphql_server.http.async_base_view import (
2526
AsyncBaseHTTPView,
2627
AsyncHTTPRequestAdapter,
2728
)
28-
from graphql_server.http import GraphQLRequestData
2929
from graphql_server.http.exceptions import HTTPException
3030
from graphql_server.http.sync_base_view import SyncBaseHTTPView, SyncHTTPRequestAdapter
3131
from graphql_server.http.temporal_response import TemporalResponse

src/graphql_server/django/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .views import GraphQLView, AsyncGraphQLView
1+
from .views import AsyncGraphQLView, GraphQLView
22

3-
__all__ = ["GraphQLView", "AsyncGraphQLView"]
3+
__all__ = ["AsyncGraphQLView", "GraphQLView"]

src/graphql_server/fastapi/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
from fastapi.datastructures import Default
3030
from fastapi.routing import APIRoute
3131
from fastapi.utils import generate_unique_id
32-
from graphql_server.http import GraphQLRequestData
3332
from graphql_server.asgi import ASGIRequestAdapter, ASGIWebSocketAdapter
3433
from graphql_server.fastapi.context import BaseContext, CustomContext
34+
from graphql_server.http import GraphQLRequestData
3535
from graphql_server.http.async_base_view import AsyncBaseHTTPView
3636
from graphql_server.http.exceptions import HTTPException
3737
from graphql_server.http.typevars import Context, RootValue

src/graphql_server/flask/views.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@ def render_graphql_ide(
135135
) -> Response:
136136
return render_template_string(
137137
self.graphql_ide_html,
138-
**{
139-
"query": request_data.query,
140-
"variables": request_data.variables,
141-
"operationName": request_data.operation_name,
142-
},
138+
query=request_data.query, variables=request_data.variables, operationName=request_data.operation_name,
143139
) # type: ignore
144140

145141

src/graphql_server/http/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import json
44
import re
55
from dataclasses import dataclass
6-
from graphql.language import DocumentNode
76
from typing import TYPE_CHECKING, Any, Optional
87
from typing_extensions import Literal, TypedDict
98

9+
from graphql.language import DocumentNode
10+
1011
if TYPE_CHECKING:
1112
from graphql import ExecutionResult
1213

src/graphql_server/http/async_base_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from typing_extensions import Literal, TypeGuard
1717

1818
from graphql import ExecutionResult, GraphQLError
19-
from graphql.language import OperationType, DocumentNode
19+
from graphql.language import OperationType
2020
from graphql.type import GraphQLSchema
2121

2222
from graphql_server import execute, subscribe

src/graphql_server/http/sync_base_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
Any,
66
Callable,
77
Generic,
8+
Literal,
89
Optional,
910
Union,
10-
Literal,
1111
)
1212

1313
from graphql import ExecutionResult, GraphQLError

src/graphql_server/litestar/controller.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,19 @@ async def handle_http_post(
374374
root_value=root_value,
375375
)
376376

377+
@websocket()
378+
async def websocket_endpoint(
379+
self,
380+
socket: WebSocket,
381+
context_ws: Any,
382+
root_value: Any,
383+
) -> None:
384+
await self.run(
385+
request=socket,
386+
context=context_ws,
387+
root_value=root_value,
388+
)
389+
377390
async def get_context(
378391
self,
379392
request: Union[Request[Any, Any, Any], WebSocket],

0 commit comments

Comments
 (0)