The following issues were found
tests/test_tutorial/test_additional_responses/test_tutorial002.py
11 issues
Line: 1
Column: 1
import os
import shutil
from fastapi.testclient import TestClient
from docs_src.additional_responses.tutorial002 import app
client = TestClient(app)
Reported by Pylint.
Line: 97
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: 99
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: 100
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: 103
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: 105
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_img():
shutil.copy("./docs/en/docs/img/favicon.png", "./image.png")
Reported by Bandit.
Line: 106
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_img():
shutil.copy("./docs/en/docs/img/favicon.png", "./image.png")
response = client.get("/items/foo?img=1")
Reported by Bandit.
Line: 109
Column: 1
assert response.json() == {"id": "foo", "value": "there goes my hero"}
def test_path_operation_img():
shutil.copy("./docs/en/docs/img/favicon.png", "./image.png")
response = client.get("/items/foo?img=1")
assert response.status_code == 200, response.text
assert response.headers["Content-Type"] == "image/png"
assert len(response.content)
Reported by Pylint.
Line: 112
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_path_operation_img():
shutil.copy("./docs/en/docs/img/favicon.png", "./image.png")
response = client.get("/items/foo?img=1")
assert response.status_code == 200, response.text
assert response.headers["Content-Type"] == "image/png"
assert len(response.content)
os.remove("./image.png")
Reported by Bandit.
Line: 113
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
shutil.copy("./docs/en/docs/img/favicon.png", "./image.png")
response = client.get("/items/foo?img=1")
assert response.status_code == 200, response.text
assert response.headers["Content-Type"] == "image/png"
assert len(response.content)
os.remove("./image.png")
Reported by Bandit.
tests/test_tutorial/test_openapi_callbacks/test_tutorial001.py
11 issues
Line: 1
Column: 1
from fastapi.testclient import TestClient
from docs_src.openapi_callbacks.tutorial001 import app, invoice_notification
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
Reported by Pylint.
Line: 14
Column: 1
"/invoices/": {
"post": {
"summary": "Create Invoice",
"description": 'Create an invoice.\n\nThis will (let\'s imagine) let the API user (some external developer) create an\ninvoice.\n\nAnd this path operation will:\n\n* Send the invoice to the client.\n* Collect the money from the client.\n* Send a notification back to the API user (the external developer), as a callback.\n * At this point is that the API will somehow send a POST request to the\n external API with the notification of the invoice event\n (e.g. "payment successful").',
"operationId": "create_invoice_invoices__post",
"parameters": [
{
"required": False,
"schema": {
Reported by Pylint.
Line: 59
Column: 1
"{$callback_url}/invoices/{$request.body.id}": {
"post": {
"summary": "Invoice Notification",
"operationId": "invoice_notification__callback_url__invoices___request_body_id__post",
"requestBody": {
"required": True,
"content": {
"application/json": {
"schema": {
Reported by Pylint.
Line: 76
Column: 1
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvoiceEventReceived"
}
}
},
},
"422": {
Reported by Pylint.
Line: 86
Column: 1
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
Reported by Pylint.
Line: 157
Column: 1
}
def test_openapi():
with client:
response = client.get("/openapi.json")
assert response.json() == openapi_schema
Reported by Pylint.
Line: 161
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
with client:
response = client.get("/openapi.json")
assert response.json() == openapi_schema
def test_get():
response = client.post(
"/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
Reported by Bandit.
Line: 164
Column: 1
assert response.json() == openapi_schema
def test_get():
response = client.post(
"/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
)
assert response.status_code == 200, response.text
assert response.json() == {"msg": "Invoice received"}
Reported by Pylint.
Line: 168
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
response = client.post(
"/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
)
assert response.status_code == 200, response.text
assert response.json() == {"msg": "Invoice received"}
def test_dummy_callback():
# Just for coverage
Reported by Bandit.
Line: 169
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
"/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
)
assert response.status_code == 200, response.text
assert response.json() == {"msg": "Invoice received"}
def test_dummy_callback():
# Just for coverage
invoice_notification({})
Reported by Bandit.
tests/test_validate_response_dataclass.py
11 issues
Line: 3
Column: 1
from typing import List, Optional
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from pydantic.dataclasses import dataclass
app = FastAPI()
Reported by Pylint.
Line: 6
Column: 1
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from pydantic.dataclasses import dataclass
app = FastAPI()
Reported by Pylint.
Line: 7
Column: 1
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from pydantic.dataclasses import dataclass
app = FastAPI()
@dataclass
Reported by Pylint.
Line: 1
Column: 1
from typing import List, Optional
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from pydantic.dataclasses import dataclass
app = FastAPI()
Reported by Pylint.
Line: 13
Column: 1
@dataclass
class Item:
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
Reported by Pylint.
Line: 20
Column: 1
@app.get("/items/invalid", response_model=Item)
def get_invalid():
return {"name": "invalid", "price": "foo"}
@app.get("/items/innerinvalid", response_model=Item)
def get_innerinvalid():
Reported by Pylint.
Line: 25
Column: 1
@app.get("/items/innerinvalid", response_model=Item)
def get_innerinvalid():
return {"name": "double invalid", "price": "foo", "owner_ids": ["foo", "bar"]}
@app.get("/items/invalidlist", response_model=List[Item])
def get_invalidlist():
Reported by Pylint.
Line: 30
Column: 1
@app.get("/items/invalidlist", response_model=List[Item])
def get_invalidlist():
return [
{"name": "foo"},
{"name": "bar", "price": "bar"},
{"name": "baz", "price": "baz"},
]
Reported by Pylint.
Line: 41
Column: 1
client = TestClient(app)
def test_invalid():
with pytest.raises(ValidationError):
client.get("/items/invalid")
def test_double_invalid():
Reported by Pylint.
Line: 46
Column: 1
client.get("/items/invalid")
def test_double_invalid():
with pytest.raises(ValidationError):
client.get("/items/innerinvalid")
def test_invalid_list():
Reported by Pylint.
docs_src/additional_responses/tutorial003.py
10 issues
Line: 1
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
Reported by Pylint.
Line: 2
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
Reported by Pylint.
Line: 3
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
Reported by Pylint.
Line: 6
Column: 1
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
class Message(BaseModel):
Reported by Pylint.
Line: 6
Column: 1
from pydantic import BaseModel
class Item(BaseModel):
id: str
value: str
class Message(BaseModel):
Reported by Pylint.
Line: 11
Column: 1
value: str
class Message(BaseModel):
message: str
app = FastAPI()
Reported by Pylint.
Line: 11
Column: 1
value: str
class Message(BaseModel):
message: str
app = FastAPI()
Reported by Pylint.
Line: 28
Column: 1
"content": {
"application/json": {
"example": {"id": "bar", "value": "The bar tenders"}
}
},
},
},
)
async def read_item(item_id: str):
Reported by Pylint.
Line: 34
Column: 5
},
)
async def read_item(item_id: str):
if item_id == "foo":
return {"id": "foo", "value": "there goes my hero"}
else:
return JSONResponse(status_code=404, content={"message": "Item not found"})
Reported by Pylint.
docs_src/handling_errors/tutorial004.py
10 issues
Line: 1
Column: 1
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import PlainTextResponse
from starlette.exceptions import HTTPException as StarletteHTTPException
app = FastAPI()
@app.exception_handler(StarletteHTTPException)
Reported by Pylint.
Line: 2
Column: 1
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import PlainTextResponse
from starlette.exceptions import HTTPException as StarletteHTTPException
app = FastAPI()
@app.exception_handler(StarletteHTTPException)
Reported by Pylint.
Line: 3
Column: 1
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import PlainTextResponse
from starlette.exceptions import HTTPException as StarletteHTTPException
app = FastAPI()
@app.exception_handler(StarletteHTTPException)
Reported by Pylint.
Line: 4
Column: 1
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import PlainTextResponse
from starlette.exceptions import HTTPException as StarletteHTTPException
app = FastAPI()
@app.exception_handler(StarletteHTTPException)
Reported by Pylint.
Line: 10
Column: 34
@app.exception_handler(StarletteHTTPException)
async def http_exception_handler(request, exc):
return PlainTextResponse(str(exc.detail), status_code=exc.status_code)
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
Reported by Pylint.
Line: 15
Column: 40
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
return PlainTextResponse(str(exc), status_code=400)
@app.get("/items/{item_id}")
async def read_item(item_id: int):
Reported by Pylint.
Line: 1
Column: 1
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import PlainTextResponse
from starlette.exceptions import HTTPException as StarletteHTTPException
app = FastAPI()
@app.exception_handler(StarletteHTTPException)
Reported by Pylint.
Line: 10
Column: 1
@app.exception_handler(StarletteHTTPException)
async def http_exception_handler(request, exc):
return PlainTextResponse(str(exc.detail), status_code=exc.status_code)
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
Reported by Pylint.
Line: 15
Column: 1
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
return PlainTextResponse(str(exc), status_code=400)
@app.get("/items/{item_id}")
async def read_item(item_id: int):
Reported by Pylint.
Line: 20
Column: 1
@app.get("/items/{item_id}")
async def read_item(item_id: int):
if item_id == 3:
raise HTTPException(status_code=418, detail="Nope! I don't like 3.")
return {"item_id": item_id}
Reported by Pylint.
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_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.
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_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.