Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for me (0.15 sec)

  1. tests/test_tutorial/test_bigger_applications/test_main_an.py

                    },
                ]
            }
        )
    
    
    def test_users_me_token_jessica(client: TestClient):
        response = client.get("/users/me?token=jessica")
        assert response.status_code == 200
        assert response.json() == {"username": "fakecurrentuser"}
    
    
    def test_users_me_with_no_token(client: TestClient):
        response = client.get("/users/me")
        assert response.status_code == 422
        assert response.json() == IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_bigger_applications/test_main_an_py39.py

                ]
            }
        )
    
    
    @needs_py39
    def test_users_me_token_jessica(client: TestClient):
        response = client.get("/users/me?token=jessica")
        assert response.status_code == 200
        assert response.json() == {"username": "fakecurrentuser"}
    
    
    @needs_py39
    def test_users_me_with_no_token(client: TestClient):
        response = client.get("/users/me")
        assert response.status_code == 422
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.9K bytes
    - Viewed (0)
  3. fastapi/security/http.py

        from fastapi import Depends, FastAPI
        from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
        app = FastAPI()
    
        security = HTTPBasic()
    
    
        @app.get("/users/me")
        def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
            return {"username": credentials.username, "password": credentials.password}
        ```
        """
    
        def __init__(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  4. tests/test_security_oauth2_optional.py

        return form_data
    
    
    @app.get("/users/me")
    def read_users_me(current_user: Optional[User] = Depends(get_current_user)):
        if current_user is None:
            return {"msg": "Create an account first"}
        return current_user
    
    
    client = TestClient(app)
    
    
    def test_security_oauth2():
        response = client.get("/users/me", headers={"Authorization": "Bearer footokenbar"})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  5. fastapi/param_functions.py

        from typing import Annotated
    
        from fastapi import Depends, FastAPI
    
        from .db import User
        from .security import get_current_active_user
    
        app = FastAPI()
    
        @app.get("/users/me/items/")
        async def read_own_items(
            current_user: Annotated[User, Security(get_current_active_user, scopes=["items"])]
        ):
            return [{"item_id": "Foo", "owner": current_user.username}]
        ```
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 62.5K bytes
    - Viewed (0)
  6. tests/test_security_oauth2.py

        return form_data
    
    
    @app.get("/users/me")
    # Here we use string annotations to test them
    def read_current_user(current_user: "User" = Depends(get_current_user)):
        return current_user
    
    
    client = TestClient(app)
    
    
    def test_security_oauth2():
        response = client.get("/users/me", headers={"Authorization": "Bearer footokenbar"})
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  7. tests/test_security_oauth2_optional_description.py

        return form_data
    
    
    @app.get("/users/me")
    def read_users_me(current_user: Optional[User] = Depends(get_current_user)):
        if current_user is None:
            return {"msg": "Create an account first"}
        return current_user
    
    
    client = TestClient(app)
    
    
    def test_security_oauth2():
        response = client.get("/users/me", headers={"Authorization": "Bearer footokenbar"})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.9K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_bigger_applications/test_main.py

                    },
                ]
            }
        )
    
    
    def test_users_me_token_jessica(client: TestClient):
        response = client.get("/users/me?token=jessica")
        assert response.status_code == 200
        assert response.json() == {"username": "fakecurrentuser"}
    
    
    def test_users_me_with_no_token(client: TestClient):
        response = client.get("/users/me")
        assert response.status_code == 422
        assert response.json() == IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
Back to top