Skip to content

Commit f1246a9

Browse files
committed
Remove skipped tests
1 parent 7716534 commit f1246a9

File tree

2 files changed

+0
-84
lines changed

2 files changed

+0
-84
lines changed

src/tests/fastapi/test_context.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -176,49 +176,6 @@ async def resolve_abc(_root, info) -> str:
176176
assert response.json() == {"data": {"abc": "abc"}}
177177

178178

179-
@pytest.mark.skip(reason="This is no longer supported")
180-
def test_with_invalid_context_getter():
181-
from fastapi import Depends, FastAPI
182-
from fastapi.testclient import TestClient
183-
from graphql_server.fastapi import GraphQLRouter
184-
185-
def custom_context_dependency() -> str:
186-
return "rocks"
187-
188-
def get_context(value: str = Depends(custom_context_dependency)) -> str:
189-
return value
190-
191-
async def resolve_abc(_root, info) -> str:
192-
assert info.context.get("request") is not None
193-
assert info.context.get("graphql_server") is None
194-
return "abc"
195-
196-
app = FastAPI()
197-
QueryType = GraphQLObjectType(
198-
name="Query",
199-
fields={
200-
"abc": GraphQLField(
201-
GraphQLString,
202-
resolve=resolve_abc,
203-
)
204-
},
205-
)
206-
207-
schema = GraphQLSchema(query=QueryType)
208-
graphql_app = GraphQLRouter(schema=schema, context_getter=get_context)
209-
app.include_router(graphql_app, prefix="/graphql")
210-
211-
test_client = TestClient(app)
212-
with pytest.raises(
213-
Exception,
214-
match=(
215-
"The custom context must be either a class "
216-
"that inherits from BaseContext or a dictionary"
217-
),
218-
):
219-
test_client.post("/graphql", json={"query": "{ abc }"})
220-
221-
222179
def test_class_context_injects_connection_params_over_transport_ws():
223180
from fastapi import Depends, FastAPI
224181
from fastapi.testclient import TestClient

src/tests/litestar/test_context.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -134,47 +134,6 @@ def resolve_abc(_root, info):
134134
assert response.json() == {"data": {"abc": "abc"}}
135135

136136

137-
@pytest.mark.skip(reason="This is no longer supported")
138-
def test_with_invalid_context_getter():
139-
def custom_context_dependency() -> str:
140-
return "rocks"
141-
142-
async def get_context(custom_context_dependency: str) -> str:
143-
return custom_context_dependency
144-
145-
def resolve_abc(_root, info):
146-
assert info.context.get("request") is not None
147-
assert info.context.get("teststring") is None
148-
return "abc"
149-
150-
Query = GraphQLObjectType(
151-
name="Query",
152-
fields={
153-
"abc": GraphQLField(
154-
GraphQLString,
155-
resolve=resolve_abc,
156-
)
157-
},
158-
)
159-
160-
schema = GraphQLSchema(query=Query)
161-
graphql_controller = make_graphql_controller(
162-
path="/graphql", schema=schema, context_getter=get_context
163-
)
164-
app = Litestar(
165-
route_handlers=[graphql_controller],
166-
dependencies={
167-
"custom_context_dependency": Provide(
168-
custom_context_dependency, sync_to_thread=True
169-
)
170-
},
171-
)
172-
test_client = TestClient(app, raise_server_exceptions=True)
173-
response = test_client.post("/graphql", json={"query": "{ abc }"})
174-
assert response.status_code == 500
175-
assert response.json()["detail"] == "Internal Server Error"
176-
177-
178137
def test_custom_context():
179138
from tests.litestar.app import create_app
180139

0 commit comments

Comments
 (0)