The following issues were found

docs_src/security/tutorial002.py
9 issues
Unable to import 'fastapi'
Error

Line: 3 Column: 1

              from typing import Optional

from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
from pydantic import BaseModel

app = FastAPI()

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")

            

Reported by Pylint.

Unable to import 'fastapi.security'
Error

Line: 4 Column: 1

              from typing import Optional

from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
from pydantic import BaseModel

app = FastAPI()

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")

            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 5 Column: 1

              
from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
from pydantic import BaseModel

app = FastAPI()

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Optional

from fastapi import Depends, FastAPI
from fastapi.security import OAuth2PasswordBearer
from pydantic import BaseModel

app = FastAPI()

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")


class User(BaseModel):
    username: str
    email: Optional[str] = None
    full_name: Optional[str] = None
    disabled: Optional[bool] = None


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 12 Column: 1

              oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")


class User(BaseModel):
    username: str
    email: Optional[str] = None
    full_name: Optional[str] = None
    disabled: Optional[bool] = None


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 1

                  disabled: Optional[bool] = None


def fake_decode_token(token):
    return User(
        username=token + "fakedecoded", email="john@example.com", full_name="John Doe"
    )



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 1

                  )


async def get_current_user(token: str = Depends(oauth2_scheme)):
    user = fake_decode_token(token)
    return user


@app.get("/users/me")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 1

              

@app.get("/users/me")
async def read_users_me(current_user: User = Depends(get_current_user)):
    return current_user

            

Reported by Pylint.

docs_src/additional_responses/tutorial004.py
9 issues
Unable to import 'fastapi'
Error

Line: 3 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str

            

Reported by Pylint.

Unable to import 'fastapi.responses'
Error

Line: 4 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str

            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 5 Column: 1

              
from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str
    value: str

            

Reported by Pylint.

Unused argument 'item_id'
Error

Line: 28 Column: 21

                  response_model=Item,
    responses={**responses, 200: {"content": {"image/png": {}}}},
)
async def read_item(item_id: str, img: Optional[bool] = None):
    if img:
        return FileResponse("image.png", media_type="image/png")
    else:
        return {"id": "foo", "value": "there goes my hero"}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel


class Item(BaseModel):
    id: str

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              from pydantic import BaseModel


class Item(BaseModel):
    id: str
    value: str


responses = {

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 8 Column: 1

              from pydantic import BaseModel


class Item(BaseModel):
    id: str
    value: str


responses = {

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

                  "/items/{item_id}",
    response_model=Item,
    responses={**responses, 200: {"content": {"image/png": {}}}},
)
async def read_item(item_id: str, img: Optional[bool] = None):
    if img:
        return FileResponse("image.png", media_type="image/png")
    else:
        return {"id": "foo", "value": "there goes my hero"}

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 29 Column: 5

                  responses={**responses, 200: {"content": {"image/png": {}}}},
)
async def read_item(item_id: str, img: Optional[bool] = None):
    if img:
        return FileResponse("image.png", media_type="image/png")
    else:
        return {"id": "foo", "value": "there goes my hero"}

            

Reported by Pylint.

tests/test_swagger_ui_init_oauth.py
9 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI
from fastapi.testclient import TestClient

swagger_ui_init_oauth = {"clientId": "the-foo-clients", "appName": "The Predendapp"}

app = FastAPI(swagger_ui_init_oauth=swagger_ui_init_oauth)


@app.get("/items/")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              

@app.get("/items/")
async def read_items():
    return {"id": "foo"}


client = TestClient(app)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              client = TestClient(app)


def test_swagger_ui():
    response = client.get("/docs")
    assert response.status_code == 200, response.text
    print(response.text)
    assert "ui.initOAuth" in response.text
    assert '"appName": "The Predendapp"' in response.text

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 19
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def test_swagger_ui():
    response = client.get("/docs")
    assert response.status_code == 200, response.text
    print(response.text)
    assert "ui.initOAuth" in response.text
    assert '"appName": "The Predendapp"' in response.text
    assert '"clientId": "the-foo-clients"' in response.text


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 21
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  response = client.get("/docs")
    assert response.status_code == 200, response.text
    print(response.text)
    assert "ui.initOAuth" in response.text
    assert '"appName": "The Predendapp"' in response.text
    assert '"clientId": "the-foo-clients"' in response.text


def test_response():

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 22
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  assert response.status_code == 200, response.text
    print(response.text)
    assert "ui.initOAuth" in response.text
    assert '"appName": "The Predendapp"' in response.text
    assert '"clientId": "the-foo-clients"' in response.text


def test_response():
    response = client.get("/items/")

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 23
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  print(response.text)
    assert "ui.initOAuth" in response.text
    assert '"appName": "The Predendapp"' in response.text
    assert '"clientId": "the-foo-clients"' in response.text


def test_response():
    response = client.get("/items/")
    assert response.json() == {"id": "foo"}

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 26 Column: 1

                  assert '"clientId": "the-foo-clients"' in response.text


def test_response():
    response = client.get("/items/")
    assert response.json() == {"id": "foo"}

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 28
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def test_response():
    response = client.get("/items/")
    assert response.json() == {"id": "foo"}

            

Reported by Bandit.

docs_src/encoder/tutorial001.py
9 issues
Unable to import 'fastapi'
Error

Line: 4 Column: 1

              from datetime import datetime
from typing import Optional

from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

fake_db = {}


            

Reported by Pylint.

Unable to import 'fastapi.encoders'
Error

Line: 5 Column: 1

              from typing import Optional

from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

fake_db = {}



            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 6 Column: 1

              
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

fake_db = {}


class Item(BaseModel):

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 21 Column: 17

              

@app.put("/items/{id}")
def update_item(id: str, item: Item):
    json_compatible_item_data = jsonable_encoder(item)
    fake_db[id] = json_compatible_item_data

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from datetime import datetime
from typing import Optional

from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel

fake_db = {}


            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              fake_db = {}


class Item(BaseModel):
    title: str
    timestamp: datetime
    description: Optional[str] = None



            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 11 Column: 1

              fake_db = {}


class Item(BaseModel):
    title: str
    timestamp: datetime
    description: Optional[str] = None



            

Reported by Pylint.

Argument name "id" doesn't conform to snake_case naming style
Error

Line: 21 Column: 1

              

@app.put("/items/{id}")
def update_item(id: str, item: Item):
    json_compatible_item_data = jsonable_encoder(item)
    fake_db[id] = json_compatible_item_data

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

              

@app.put("/items/{id}")
def update_item(id: str, item: Item):
    json_compatible_item_data = jsonable_encoder(item)
    fake_db[id] = json_compatible_item_data

            

Reported by Pylint.

tests/test_empty_router.py
9 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest
from fastapi import APIRouter, FastAPI
from fastapi.testclient import TestClient

app = FastAPI()

router = APIRouter()



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest
from fastapi import APIRouter, FastAPI
from fastapi.testclient import TestClient

app = FastAPI()

router = APIRouter()



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              

@router.get("")
def get_empty():
    return ["OK"]


app.include_router(router, prefix="/prefix")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

              client = TestClient(app)


def test_use_empty():
    with client:
        response = client.get("/prefix")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]


            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 24
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_use_empty():
    with client:
        response = client.get("/prefix")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]

        response = client.get("/prefix/")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 25
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  with client:
        response = client.get("/prefix")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]

        response = client.get("/prefix/")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 28
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      assert response.json() == ["OK"]

        response = client.get("/prefix/")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]


def test_include_empty():
    # if both include and router.path are empty - it should raise exception

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 29
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
        response = client.get("/prefix/")
        assert response.status_code == 200, response.text
        assert response.json() == ["OK"]


def test_include_empty():
    # if both include and router.path are empty - it should raise exception
    with pytest.raises(Exception):

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 32 Column: 1

                      assert response.json() == ["OK"]


def test_include_empty():
    # if both include and router.path are empty - it should raise exception
    with pytest.raises(Exception):
        app.include_router(router)

            

Reported by Pylint.

tests/test_datetime_custom_encoder.py
9 issues
Unable to import 'pydantic'
Error

Line: 5 Column: 1

              
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel


class ModelWithDatetimeField(BaseModel):
    dt_field: datetime


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from datetime import datetime, timezone

from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel


class ModelWithDatetimeField(BaseModel):
    dt_field: datetime

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 8 Column: 1

              from pydantic import BaseModel


class ModelWithDatetimeField(BaseModel):
    dt_field: datetime

    class Config:
        json_encoders = {
            datetime: lambda dt: dt.replace(

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              from pydantic import BaseModel


class ModelWithDatetimeField(BaseModel):
    dt_field: datetime

    class Config:
        json_encoders = {
            datetime: lambda dt: dt.replace(

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 11 Column: 5

              class ModelWithDatetimeField(BaseModel):
    dt_field: datetime

    class Config:
        json_encoders = {
            datetime: lambda dt: dt.replace(
                microsecond=0, tzinfo=timezone.utc
            ).isoformat()
        }

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 5

              class ModelWithDatetimeField(BaseModel):
    dt_field: datetime

    class Config:
        json_encoders = {
            datetime: lambda dt: dt.replace(
                microsecond=0, tzinfo=timezone.utc
            ).isoformat()
        }

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

              

@app.get("/model", response_model=ModelWithDatetimeField)
def get_model():
    return model


client = TestClient(app)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 1

              client = TestClient(app)


def test_dt():
    with client:
        response = client.get("/model")
    assert response.json() == {"dt_field": "2019-01-01T08:00:00+00:00"}

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 34
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_dt():
    with client:
        response = client.get("/model")
    assert response.json() == {"dt_field": "2019-01-01T08:00:00+00:00"}

            

Reported by Bandit.

docs_src/body_multiple_params/tutorial004.py
9 issues
Unable to import 'fastapi'
Error

Line: 3 Column: 1

              from typing import Optional

from fastapi import Body, FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Unable to import 'pydantic'
Error

Line: 4 Column: 1

              from typing import Optional

from fastapi import Body, FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Optional

from fastapi import Body, FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              app = FastAPI()


class Item(BaseModel):
    name: str
    description: Optional[str] = None
    price: float
    tax: Optional[float] = None


            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 9 Column: 1

              app = FastAPI()


class Item(BaseModel):
    name: str
    description: Optional[str] = None
    price: float
    tax: Optional[float] = None


            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

                  tax: Optional[float] = None


class User(BaseModel):
    username: str
    full_name: Optional[str] = None


@app.put("/items/{item_id}")

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 16 Column: 1

                  tax: Optional[float] = None


class User(BaseModel):
    username: str
    full_name: Optional[str] = None


@app.put("/items/{item_id}")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 1

              

@app.put("/items/{item_id}")
async def update_item(
    *,
    item_id: int,
    item: Item,
    user: User,
    importance: int = Body(..., gt=0),

            

Reported by Pylint.

Variable name "q" doesn't conform to snake_case naming style
Error

Line: 28 Column: 5

                  item: Item,
    user: User,
    importance: int = Body(..., gt=0),
    q: Optional[str] = None
):
    results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
    if q:
        results.update({"q": q})
    return results

            

Reported by Pylint.

tests/test_datastructures.py
9 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest
from fastapi import UploadFile
from fastapi.datastructures import Default


def test_upload_file_invalid():
    with pytest.raises(ValueError):
        UploadFile.validate("not a Starlette UploadFile")


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest
from fastapi import UploadFile
from fastapi.datastructures import Default


def test_upload_file_invalid():
    with pytest.raises(ValueError):
        UploadFile.validate("not a Starlette UploadFile")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              from fastapi.datastructures import Default


def test_upload_file_invalid():
    with pytest.raises(ValueError):
        UploadFile.validate("not a Starlette UploadFile")


def test_default_placeholder_equals():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

                      UploadFile.validate("not a Starlette UploadFile")


def test_default_placeholder_equals():
    placeholder_1 = Default("a")
    placeholder_2 = Default("a")
    assert placeholder_1 == placeholder_2
    assert placeholder_1.value == placeholder_2.value


            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 14
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_default_placeholder_equals():
    placeholder_1 = Default("a")
    placeholder_2 = Default("a")
    assert placeholder_1 == placeholder_2
    assert placeholder_1.value == placeholder_2.value


def test_default_placeholder_bool():
    placeholder_a = Default("a")

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 15
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  placeholder_1 = Default("a")
    placeholder_2 = Default("a")
    assert placeholder_1 == placeholder_2
    assert placeholder_1.value == placeholder_2.value


def test_default_placeholder_bool():
    placeholder_a = Default("a")
    placeholder_b = Default("")

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 18 Column: 1

                  assert placeholder_1.value == placeholder_2.value


def test_default_placeholder_bool():
    placeholder_a = Default("a")
    placeholder_b = Default("")
    assert placeholder_a
    assert not placeholder_b

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 21
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test_default_placeholder_bool():
    placeholder_a = Default("a")
    placeholder_b = Default("")
    assert placeholder_a
    assert not placeholder_b

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 22
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  placeholder_a = Default("a")
    placeholder_b = Default("")
    assert placeholder_a
    assert not placeholder_b

            

Reported by Bandit.

tests/test_additional_responses_default_validationerror.py
9 issues
Unused argument 'id'
Error

Line: 8 Column: 13

              

@app.get("/a/{id}")
async def a(id):
    pass  # pragma: no cover


openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Redefining built-in 'id'
Error

Line: 8 Column: 13

              

@app.get("/a/{id}")
async def a(id):
    pass  # pragma: no cover


openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from fastapi import FastAPI
from fastapi.testclient import TestClient

app = FastAPI()


@app.get("/a/{id}")
async def a(id):
    pass  # pragma: no cover

            

Reported by Pylint.

Function name "a" doesn't conform to snake_case naming style
Error

Line: 8 Column: 1

              

@app.get("/a/{id}")
async def a(id):
    pass  # pragma: no cover


openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Argument name "id" doesn't conform to snake_case naming style
Error

Line: 8 Column: 1

              

@app.get("/a/{id}")
async def a(id):
    pass  # pragma: no cover


openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 1

              

@app.get("/a/{id}")
async def a(id):
    pass  # pragma: no cover


openapi_schema = {
    "openapi": "3.0.2",

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 82 Column: 1

              client = TestClient(app)


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 84
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

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 85
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

            

Reported by Bandit.

tests/test_tutorial/test_extending_openapi/test_tutorial001.py
9 issues
Missing module docstring
Error

Line: 1 Column: 1

              from fastapi.testclient import TestClient

from docs_src.extending_openapi.tutorial001 import app

client = TestClient(app)

openapi_schema = {
    "openapi": "3.0.2",
    "info": {

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 32 Column: 1

              }


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 34
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
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 35
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
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema



            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 37
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  assert response.status_code == 200, response.text
    assert response.json() == openapi_schema
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


def test():
    response = client.get("/items/")

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 38
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  assert response.json() == openapi_schema
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == openapi_schema


def test():
    response = client.get("/items/")
    assert response.status_code == 200, response.text

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 41 Column: 1

                  assert response.json() == openapi_schema


def test():
    response = client.get("/items/")
    assert response.status_code == 200, response.text
    assert response.json() == [{"name": "Foo"}]

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 43
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def test():
    response = client.get("/items/")
    assert response.status_code == 200, response.text
    assert response.json() == [{"name": "Foo"}]

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 44
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              def test():
    response = client.get("/items/")
    assert response.status_code == 200, response.text
    assert response.json() == [{"name": "Foo"}]

            

Reported by Bandit.