Browse Source

♻️ Refactor test names and files to simplify

pull/11355/head
Sebastián Ramírez 8 months ago
parent
commit
145d1de598
  1. 0
      tests/test_stringified_annotations/__init__.py
  2. 13
      tests/test_stringified_annotations/test_stringified_annotations_simple.py
  3. 6
      tests/test_stringified_annotations/test_stringified_annotations_with_import.py
  4. 3
      tests/test_stringified_annotations/wrapper.py

0
tests/test_future/__init__.py → tests/test_stringified_annotations/__init__.py

13
tests/test_future/test_future_9095.py → tests/test_stringified_annotations/test_stringified_annotations_simple.py

@ -11,16 +11,17 @@ app = FastAPI()
client = TestClient(app)
class Test:
class Dep:
def __call__(self, request: Request):
return "test"
@needs_py310
def test_call():
@app.get("/test/")
def call(test: str = Depends(Test())):
return {"test": test}
@app.get("/test/")
def call(test: str = Depends(Dep())):
return {"test": test}
@needs_py310
def test_stringified_annotations():
response = client.get("/test")
assert response.status_code == 200

6
tests/test_future/test_future_6465.py → tests/test_stringified_annotations/test_stringified_annotations_with_import.py

@ -7,7 +7,7 @@ from fastapi.testclient import TestClient
from pydantic import BaseModel
from ..utils import needs_py310
from .login_tool import login_required
from .wrapper import wrap
app = FastAPI()
client = TestClient(app)
@ -21,9 +21,9 @@ class Item(BaseModel):
@needs_py310
def test_future_6465():
def test_stringified_annotations_import():
@app.get("/items/")
@login_required
@wrap
def get_item(item_id: int) -> Item:
return Item(name="name", price=42.42)

3
tests/test_future/login_tool.py → tests/test_stringified_annotations/wrapper.py

@ -1,10 +1,9 @@
from functools import wraps
def login_required(func):
def wrap(func):
@wraps(func)
def wrapper(*args, **kwargs):
# login functionality could come here
return func(*args, **kwargs)
return wrapper
Loading…
Cancel
Save