Skip to content

Commit

Permalink
+heartbeat callback test
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
  • Loading branch information
bigcat88 committed Jul 23, 2023
1 parent e53a7ea commit 4b61c12
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
APP = FastAPI()


@APP.put("/sec_check")
def sec_check(
value: int,
nc: Annotated[NextcloudApp, Depends(nc_app)],
):
print(value)
_ = nc
return JSONResponse(content={"error": ""}, status_code=200)


def enabled_handler(enabled: bool, nc: NextcloudApp) -> str:
print(f"enabled_handler: enabled={enabled}", flush=True)
if enabled:
Expand All @@ -27,14 +37,8 @@ def enabled_handler(enabled: bool, nc: NextcloudApp) -> str:
return ""


@APP.put("/sec_check")
def sec_check(
value: int,
nc: Annotated[NextcloudApp, Depends(nc_app)],
):
print(value)
_ = nc
return JSONResponse(content={"error": ""}, status_code=200)
def heartbeat_callback():
return "ok"


@APP.on_event("startup")
Expand All @@ -54,7 +58,7 @@ def initialization():
"optional": [],
},
)
enable_heartbeat(APP)
enable_heartbeat(APP, heartbeat_callback)


if __name__ == "__main__":
Expand Down

0 comments on commit 4b61c12

Please sign in to comment.