mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
Return a boolean directly from API endpoint for project locked status
This commit is contained in:
parent
27debfff8d
commit
2976e220dc
@ -396,12 +396,12 @@ async def duplicate_project(
|
||||
|
||||
|
||||
@router.get("/{project_id}/locked")
|
||||
async def locked_project(project: Project = Depends(dep_project)) -> dict:
|
||||
async def locked_project(project: Project = Depends(dep_project)) -> bool:
|
||||
"""
|
||||
Returns whether a project is locked or not
|
||||
"""
|
||||
|
||||
return {"result": project.locked}
|
||||
return project.locked
|
||||
|
||||
|
||||
@router.post("/{project_id}/lock", status_code=status.HTTP_204_NO_CONTENT)
|
||||
|
@ -513,7 +513,7 @@ async def test_lock_unlock(app: FastAPI, client: AsyncClient, project: Project,
|
||||
|
||||
response = await client.get(app.url_path_for("locked_project", project_id=project.id))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert response.json()["result"] is True
|
||||
assert response.json() is True
|
||||
|
||||
response = await client.post(app.url_path_for("unlock_project", project_id=project.id))
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
|
Loading…
Reference in New Issue
Block a user