The following issues were found
tests/test_tutorial/test_handling_errors/test_tutorial003.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.handling_errors.tutorial003 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 74
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 76
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_get():
response = client.get("/unicorns/shinny")
Reported by Bandit.
Line: 77
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_get():
response = client.get("/unicorns/shinny")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 80
Column: 1
assert response.json() == openapi_schema
def test_get():
response = client.get("/unicorns/shinny")
assert response.status_code == 200, response.text
assert response.json() == {"unicorn_name": "shinny"}
Reported by Pylint.
Line: 82
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get():
response = client.get("/unicorns/shinny")
assert response.status_code == 200, response.text
assert response.json() == {"unicorn_name": "shinny"}
def test_get_exception():
response = client.get("/unicorns/yolo")
Reported by Bandit.
Line: 83
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get():
response = client.get("/unicorns/shinny")
assert response.status_code == 200, response.text
assert response.json() == {"unicorn_name": "shinny"}
def test_get_exception():
response = client.get("/unicorns/yolo")
assert response.status_code == 418, response.text
Reported by Bandit.
Line: 86
Column: 1
assert response.json() == {"unicorn_name": "shinny"}
def test_get_exception():
response = client.get("/unicorns/yolo")
assert response.status_code == 418, response.text
assert response.json() == {
"message": "Oops! yolo did something. There goes a rainbow..."
}
Reported by Pylint.
Line: 88
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get_exception():
response = client.get("/unicorns/yolo")
assert response.status_code == 418, response.text
assert response.json() == {
"message": "Oops! yolo did something. There goes a rainbow..."
}
Reported by Bandit.
Line: 89
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get_exception():
response = client.get("/unicorns/yolo")
assert response.status_code == 418, response.text
assert response.json() == {
"message": "Oops! yolo did something. There goes a rainbow..."
}
Reported by Bandit.
tests/test_tutorial/test_query_params_str_validations/test_tutorial012.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.query_params_str_validations.tutorial012 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 79
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 81
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_default_query_values():
url = "/items/"
Reported by Bandit.
Line: 82
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_default_query_values():
url = "/items/"
response = client.get(url)
Reported by Bandit.
Line: 85
Column: 1
assert response.json() == openapi_schema
def test_default_query_values():
url = "/items/"
response = client.get(url)
assert response.status_code == 200, response.text
assert response.json() == {"q": ["foo", "bar"]}
Reported by Pylint.
Line: 88
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_default_query_values():
url = "/items/"
response = client.get(url)
assert response.status_code == 200, response.text
assert response.json() == {"q": ["foo", "bar"]}
def test_multi_query_values():
url = "/items/?q=baz&q=foobar"
Reported by Bandit.
Line: 89
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
url = "/items/"
response = client.get(url)
assert response.status_code == 200, response.text
assert response.json() == {"q": ["foo", "bar"]}
def test_multi_query_values():
url = "/items/?q=baz&q=foobar"
response = client.get(url)
Reported by Bandit.
Line: 92
Column: 1
assert response.json() == {"q": ["foo", "bar"]}
def test_multi_query_values():
url = "/items/?q=baz&q=foobar"
response = client.get(url)
assert response.status_code == 200, response.text
assert response.json() == {"q": ["baz", "foobar"]}
Reported by Pylint.
Line: 95
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_multi_query_values():
url = "/items/?q=baz&q=foobar"
response = client.get(url)
assert response.status_code == 200, response.text
assert response.json() == {"q": ["baz", "foobar"]}
Reported by Bandit.
Line: 96
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
url = "/items/?q=baz&q=foobar"
response = client.get(url)
assert response.status_code == 200, response.text
assert response.json() == {"q": ["baz", "foobar"]}
Reported by Bandit.
docs_src/extra_models/tutorial003.py
10 issues
Line: 3
Column: 1
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
Reported by Pylint.
Line: 4
Column: 1
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
Reported by Pylint.
Line: 1
Column: 1
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class BaseItem(BaseModel):
Reported by Pylint.
Line: 9
Column: 1
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
Reported by Pylint.
Line: 9
Column: 1
app = FastAPI()
class BaseItem(BaseModel):
description: str
type: str
class CarItem(BaseItem):
Reported by Pylint.
Line: 14
Column: 1
type: str
class CarItem(BaseItem):
type = "car"
class PlaneItem(BaseItem):
type = "plane"
Reported by Pylint.
Line: 14
Column: 1
type: str
class CarItem(BaseItem):
type = "car"
class PlaneItem(BaseItem):
type = "plane"
Reported by Pylint.
Line: 18
Column: 1
type = "car"
class PlaneItem(BaseItem):
type = "plane"
size: int
items = {
Reported by Pylint.
Line: 18
Column: 1
type = "car"
class PlaneItem(BaseItem):
type = "plane"
size: int
items = {
Reported by Pylint.
Line: 34
Column: 1
@app.get("/items/{item_id}", response_model=Union[PlaneItem, CarItem])
async def read_item(item_id: str):
return items[item_id]
Reported by Pylint.
docs_src/body_nested_models/tutorial007.py
10 issues
Line: 3
Column: 1
from typing import List, Optional, Set
from fastapi import FastAPI
from pydantic import BaseModel, HttpUrl
app = FastAPI()
class Image(BaseModel):
Reported by Pylint.
Line: 4
Column: 1
from typing import List, Optional, Set
from fastapi import FastAPI
from pydantic import BaseModel, HttpUrl
app = FastAPI()
class Image(BaseModel):
Reported by Pylint.
Line: 1
Column: 1
from typing import List, Optional, Set
from fastapi import FastAPI
from pydantic import BaseModel, HttpUrl
app = FastAPI()
class Image(BaseModel):
Reported by Pylint.
Line: 9
Column: 1
app = FastAPI()
class Image(BaseModel):
url: HttpUrl
name: str
class Item(BaseModel):
Reported by Pylint.
Line: 9
Column: 1
app = FastAPI()
class Image(BaseModel):
url: HttpUrl
name: str
class Item(BaseModel):
Reported by Pylint.
Line: 14
Column: 1
name: str
class Item(BaseModel):
name: str
description: Optional[str] = None
price: float
tax: Optional[float] = None
tags: Set[str] = set()
Reported by Pylint.
Line: 14
Column: 1
name: str
class Item(BaseModel):
name: str
description: Optional[str] = None
price: float
tax: Optional[float] = None
tags: Set[str] = set()
Reported by Pylint.
Line: 23
Column: 1
images: Optional[List[Image]] = None
class Offer(BaseModel):
name: str
description: Optional[str] = None
price: float
items: List[Item]
Reported by Pylint.
Line: 23
Column: 1
images: Optional[List[Image]] = None
class Offer(BaseModel):
name: str
description: Optional[str] = None
price: float
items: List[Item]
Reported by Pylint.
Line: 31
Column: 1
@app.post("/offers/")
async def create_offer(offer: Offer):
return offer
Reported by Pylint.
tests/test_tutorial/test_path_params/test_tutorial004.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.path_params.tutorial004 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 74
Column: 1
}
def test_openapi():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 76
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_file_path():
response = client.get("/files/home/johndoe/myfile.txt")
Reported by Bandit.
Line: 77
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_file_path():
response = client.get("/files/home/johndoe/myfile.txt")
print(response.content)
Reported by Bandit.
Line: 80
Column: 1
assert response.json() == openapi_schema
def test_file_path():
response = client.get("/files/home/johndoe/myfile.txt")
print(response.content)
assert response.status_code == 200, response.text
assert response.json() == {"file_path": "home/johndoe/myfile.txt"}
Reported by Pylint.
Line: 83
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_file_path():
response = client.get("/files/home/johndoe/myfile.txt")
print(response.content)
assert response.status_code == 200, response.text
assert response.json() == {"file_path": "home/johndoe/myfile.txt"}
def test_root_file_path():
response = client.get("/files//home/johndoe/myfile.txt")
Reported by Bandit.
Line: 84
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
response = client.get("/files/home/johndoe/myfile.txt")
print(response.content)
assert response.status_code == 200, response.text
assert response.json() == {"file_path": "home/johndoe/myfile.txt"}
def test_root_file_path():
response = client.get("/files//home/johndoe/myfile.txt")
print(response.content)
Reported by Bandit.
Line: 87
Column: 1
assert response.json() == {"file_path": "home/johndoe/myfile.txt"}
def test_root_file_path():
response = client.get("/files//home/johndoe/myfile.txt")
print(response.content)
assert response.status_code == 200, response.text
assert response.json() == {"file_path": "/home/johndoe/myfile.txt"}
Reported by Pylint.
Line: 90
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_root_file_path():
response = client.get("/files//home/johndoe/myfile.txt")
print(response.content)
assert response.status_code == 200, response.text
assert response.json() == {"file_path": "/home/johndoe/myfile.txt"}
Reported by Bandit.
Line: 91
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
response = client.get("/files//home/johndoe/myfile.txt")
print(response.content)
assert response.status_code == 200, response.text
assert response.json() == {"file_path": "/home/johndoe/myfile.txt"}
Reported by Bandit.
tests/test_tutorial/test_additional_responses/test_tutorial001.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.additional_responses.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 101
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 103
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_path_operation():
response = client.get("/items/foo")
Reported by Bandit.
Line: 104
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 107
Column: 1
assert response.json() == openapi_schema
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"id": "foo", "value": "there goes my hero"}
Reported by Pylint.
Line: 109
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_not_found():
response = client.get("/items/bar")
Reported by Bandit.
Line: 110
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
Reported by Bandit.
Line: 113
Column: 1
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
assert response.json() == {"message": "Item not found"}
Reported by Pylint.
Line: 115
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
assert response.json() == {"message": "Item not found"}
Reported by Bandit.
Line: 116
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
assert response.json() == {"message": "Item not found"}
Reported by Bandit.
tests/test_tutorial/test_extra_models/test_tutorial003.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.extra_models.tutorial003 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 103
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 105
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_get_car():
response = client.get("/items/item1")
Reported by Bandit.
Line: 106
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_get_car():
response = client.get("/items/item1")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 109
Column: 1
assert response.json() == openapi_schema
def test_get_car():
response = client.get("/items/item1")
assert response.status_code == 200, response.text
assert response.json() == {
"description": "All my friends drive a low rider",
"type": "car",
Reported by Pylint.
Line: 111
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get_car():
response = client.get("/items/item1")
assert response.status_code == 200, response.text
assert response.json() == {
"description": "All my friends drive a low rider",
"type": "car",
}
Reported by Bandit.
Line: 112
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get_car():
response = client.get("/items/item1")
assert response.status_code == 200, response.text
assert response.json() == {
"description": "All my friends drive a low rider",
"type": "car",
}
Reported by Bandit.
Line: 118
Column: 1
}
def test_get_plane():
response = client.get("/items/item2")
assert response.status_code == 200, response.text
assert response.json() == {
"description": "Music is my aeroplane, it's my aeroplane",
"type": "plane",
Reported by Pylint.
Line: 120
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get_plane():
response = client.get("/items/item2")
assert response.status_code == 200, response.text
assert response.json() == {
"description": "Music is my aeroplane, it's my aeroplane",
"type": "plane",
"size": 5,
}
Reported by Bandit.
Line: 121
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_get_plane():
response = client.get("/items/item2")
assert response.status_code == 200, response.text
assert response.json() == {
"description": "Music is my aeroplane, it's my aeroplane",
"type": "plane",
"size": 5,
}
Reported by Bandit.
tests/test_tutorial/test_response_model/test_tutorial005.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.response_model.tutorial005 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 123
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 125
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_read_item_name():
response = client.get("/items/bar/name")
Reported by Bandit.
Line: 126
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 129
Column: 1
assert response.json() == openapi_schema
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
Reported by Pylint.
Line: 131
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
def test_read_item_public_data():
response = client.get("/items/bar/public")
Reported by Bandit.
Line: 132
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 135
Column: 1
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "Bar",
"description": "The Bar fighters",
Reported by Pylint.
Line: 137
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "Bar",
"description": "The Bar fighters",
"price": 62,
}
Reported by Bandit.
Line: 138
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "Bar",
"description": "The Bar fighters",
"price": 62,
}
Reported by Bandit.
tests/test_tutorial/test_response_model/test_tutorial006.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.response_model.tutorial006 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 123
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 125
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_read_item_name():
response = client.get("/items/bar/name")
Reported by Bandit.
Line: 126
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 129
Column: 1
assert response.json() == openapi_schema
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
Reported by Pylint.
Line: 131
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
def test_read_item_public_data():
response = client.get("/items/bar/public")
Reported by Bandit.
Line: 132
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_name():
response = client.get("/items/bar/name")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 135
Column: 1
assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "Bar",
"description": "The Bar fighters",
Reported by Pylint.
Line: 137
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "Bar",
"description": "The Bar fighters",
"price": 62,
}
Reported by Bandit.
Line: 138
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_read_item_public_data():
response = client.get("/items/bar/public")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "Bar",
"description": "The Bar fighters",
"price": 62,
}
Reported by Bandit.
tests/test_tutorial/test_additional_responses/test_tutorial003.py
10 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.additional_responses.tutorial003 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 102
Column: 1
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Reported by Pylint.
Line: 104
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_path_operation():
response = client.get("/items/foo")
Reported by Bandit.
Line: 105
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
Reported by Bandit.
Line: 108
Column: 1
assert response.json() == openapi_schema
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"id": "foo", "value": "there goes my hero"}
Reported by Pylint.
Line: 110
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_not_found():
response = client.get("/items/bar")
Reported by Bandit.
Line: 111
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation():
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
Reported by Bandit.
Line: 114
Column: 1
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
assert response.json() == {"message": "Item not found"}
Reported by Pylint.
Line: 116
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
assert response.json() == {"message": "Item not found"}
Reported by Bandit.
Line: 117
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation_not_found():
response = client.get("/items/bar")
assert response.status_code == 404, response.text
assert response.json() == {"message": "Item not found"}
Reported by Bandit.