fix: Update CloudProjectCreateResponse schema to match API response

The /proxy/projects/projects POST endpoint returns a ProjectStatusResponse
with fields: message, status, default, old_project, new_project.

Updated CloudProjectCreateResponse schema to match this format instead of
expecting name, path, message fields.

Also updated all related tests to use the correct response format:
- tests/cli/test_cloud_utils.py (3 tests)
- tests/cli/test_bisync_commands.py (1 test)

Fixes the validation error when creating cloud projects via upload command:
"bm cloud upload --project test --create-project specs"

Signed-off-by: Pablo Hernandez <pablo@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
phernandez
2025-10-13 23:56:59 -05:00
parent 5258f45730
commit ba74ca7e18
4 changed files with 28 additions and 19 deletions
-1
View File
@@ -87,7 +87,6 @@ async def get_client() -> AsyncIterator[AsyncClient]:
# Auth header set ONCE at client creation
proxy_base_url = f"{config.cloud_host}/proxy"
logger.info(f"Creating HTTP client for cloud proxy at: {proxy_base_url}")
print(f"proxy_base_url: {proxy_base_url}")
async with AsyncClient(
base_url=proxy_base_url,
headers={"Authorization": f"Bearer {token}"},
+5 -3
View File
@@ -41,6 +41,8 @@ class CloudProjectCreateRequest(BaseModel):
class CloudProjectCreateResponse(BaseModel):
"""Response from creating a cloud project."""
name: str = Field(..., description="Created project name")
path: str = Field(..., description="Created project path")
message: str = Field(default="", description="Success message")
message: str = Field(..., description="Status message about the project creation")
status: str = Field(..., description="Status of the creation (success or error)")
default: bool = Field(..., description="True if the project was set as the default")
old_project: dict | None = Field(None, description="Information about the previous project")
new_project: dict | None = Field(None, description="Information about the newly created project")