Browse Source

Export OAuth2PasswordRequestFormStrict from security (#1462)

* Update __init__.py

Fixes an import error:     

from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestFormStrict
ImportError: cannot import name 'OAuth2PasswordRequestFormStrict'

* Simplify import of OAuth2PasswordRequestFormStrict

* Simplify import of OAuth2PasswordRequestFormStrict
pull/1576/head
Richard Hoekstra 5 years ago
committed by GitHub
parent
commit
bd2acbcabb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      fastapi/security/__init__.py
  2. 3
      tests/test_security_oauth2.py
  3. 3
      tests/test_security_oauth2_optional.py

1
fastapi/security/__init__.py

@ -11,6 +11,7 @@ from .oauth2 import (
OAuth2AuthorizationCodeBearer,
OAuth2PasswordBearer,
OAuth2PasswordRequestForm,
OAuth2PasswordRequestFormStrict,
SecurityScopes,
)
from .open_id_connect_url import OpenIdConnect

3
tests/test_security_oauth2.py

@ -1,7 +1,6 @@
import pytest
from fastapi import Depends, FastAPI, Security
from fastapi.security import OAuth2
from fastapi.security.oauth2 import OAuth2PasswordRequestFormStrict
from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
from fastapi.testclient import TestClient
from pydantic import BaseModel

3
tests/test_security_oauth2_optional.py

@ -2,8 +2,7 @@ from typing import Optional
import pytest
from fastapi import Depends, FastAPI, Security
from fastapi.security import OAuth2
from fastapi.security.oauth2 import OAuth2PasswordRequestFormStrict
from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
from fastapi.testclient import TestClient
from pydantic import BaseModel

Loading…
Cancel
Save