Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 2,109 for App (0.17 sec)

  1. docs/zh/docs/tutorial/testing.md

    您的**FastAPI**应用程序也可能由一些文件/模块组成等等。
    
    ### **FastAPI** app 文件
    
    假设你有一个像 [更大的应用](bigger-applications.md){.internal-link target=_blank} 中所描述的文件结构:
    
    ```
    .
    ├── app
    │   ├── __init__.py
    │   └── main.py
    ```
    
    在 `main.py` 文件中你有一个 **FastAPI** app:
    
    
    ```Python
    {!../../../docs_src/app_testing/main.py!}
    ```
    
    ### 测试文件
    
    然后你会有一个包含测试的文件 `test_main.py` 。app可以像Python包那样存在(一样是目录,但有个 `__init__.py` 文件):
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6K bytes
    - Viewed (0)
  2. src/main/java/org/codelibs/fess/app/web/admin/AdminAction.java

    import org.codelibs.fess.app.web.admin.dashboard.AdminDashboardAction;
    import org.codelibs.fess.app.web.admin.dataconfig.AdminDataconfigAction;
    import org.codelibs.fess.app.web.admin.design.AdminDesignAction;
    import org.codelibs.fess.app.web.admin.dict.AdminDictAction;
    import org.codelibs.fess.app.web.admin.duplicatehost.AdminDuplicatehostAction;
    import org.codelibs.fess.app.web.admin.elevateword.AdminElevatewordAction;
    Java
    - Registered: Mon Apr 29 08:04:11 GMT 2024
    - Last Modified: Thu Feb 22 01:37:57 GMT 2024
    - 18.7K bytes
    - Viewed (0)
  3. docs_src/custom_docs_ui/tutorial002.py

    )
    from fastapi.staticfiles import StaticFiles
    
    app = FastAPI(docs_url=None, redoc_url=None)
    
    app.mount("/static", StaticFiles(directory="static"), name="static")
    
    
    @app.get("/docs", include_in_schema=False)
    async def custom_swagger_ui_html():
        return get_swagger_ui_html(
            openapi_url=app.openapi_url,
            title=app.title + " - Swagger UI",
            oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  4. docs_src/extending_openapi/tutorial001.py

    from fastapi import FastAPI
    from fastapi.openapi.utils import get_openapi
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items():
        return [{"name": "Foo"}]
    
    
    def custom_openapi():
        if app.openapi_schema:
            return app.openapi_schema
        openapi_schema = get_openapi(
            title="Custom title",
            version="2.5.0",
            summary="This is a very custom OpenAPI schema",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 737 bytes
    - Viewed (0)
  5. docs_src/custom_docs_ui/tutorial001.py

        get_swagger_ui_html,
        get_swagger_ui_oauth2_redirect_html,
    )
    
    app = FastAPI(docs_url=None, redoc_url=None)
    
    
    @app.get("/docs", include_in_schema=False)
    async def custom_swagger_ui_html():
        return get_swagger_ui_html(
            openapi_url=app.openapi_url,
            title=app.title + " - Swagger UI",
            oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Oct 30 09:58:58 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_websockets/test_tutorial002_an_py39.py

    from fastapi.websockets import WebSocketDisconnect
    
    from ...utils import needs_py39
    
    
    @pytest.fixture(name="app")
    def get_app():
        from docs_src.websockets.tutorial002_an_py39 import app
    
        return app
    
    
    @needs_py39
    def test_main(app: FastAPI):
        client = TestClient(app)
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<!DOCTYPE html>" in response.content
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  7. tests/test_starlette_urlconvertors.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/int/{param:int}")
    def int_convertor(param: int = Path()):
        return {"int": param}
    
    
    @app.get("/float/{param:float}")
    def float_convertor(param: float = Path()):
        return {"float": param}
    
    
    @app.get("/path/{param:path}")
    def path_convertor(param: str = Path()):
        return {"path": param}
    
    
    @app.get("/query/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 27 14:46:06 GMT 2022
    - 1.7K bytes
    - Viewed (0)
  8. tests/test_custom_middleware_exception.py

                await self.app(scope, receive, send)
                return
    
            wrapper = self.receive_wrapper(receive)
            await self.app(scope, wrapper, send)
    
    
    @router.post("/middleware")
    def run_middleware(file: UploadFile = File(..., description="Big File")):
        return {"message": "OK"}
    
    
    app.include_router(router)
    app.add_middleware(ContentSizeLimitMiddleware, max_content_size=2**8)
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 25 21:44:40 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  9. src/main/java/org/codelibs/fess/app/web/api/admin/boostdoc/ApiAdminBoostdocAction.java

    import org.codelibs.fess.app.pager.BoostDocPager;
    import org.codelibs.fess.app.service.BoostDocumentRuleService;
    import org.codelibs.fess.app.web.CrudMode;
    import org.codelibs.fess.app.web.api.ApiResult;
    import org.codelibs.fess.app.web.api.ApiResult.ApiConfigResponse;
    import org.codelibs.fess.app.web.api.ApiResult.ApiConfigsResponse;
    import org.codelibs.fess.app.web.api.ApiResult.ApiResponse;
    Java
    - Registered: Mon Apr 29 08:04:11 GMT 2024
    - Last Modified: Thu Feb 22 01:37:57 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_websockets/test_tutorial002_an_py310.py

    from fastapi.websockets import WebSocketDisconnect
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="app")
    def get_app():
        from docs_src.websockets.tutorial002_an_py310 import app
    
        return app
    
    
    @needs_py310
    def test_main(app: FastAPI):
        client = TestClient(app)
        response = client.get("/")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
Back to top