Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/capawesome_cloud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class CapawesomeModel(BaseModel):
class App(CapawesomeModel):
name: Optional[str] = None
type: Optional[str] = None
build_stack: Optional[str] = None
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None

Expand Down
8 changes: 7 additions & 1 deletion src/capawesome_cloud/resources/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,22 @@ def update(
type: Union[str, NotGiven] = NOT_GIVEN,
app_channel_id: Union[str, None, NotGiven] = NOT_GIVEN,
app_environment_id: Union[str, None, NotGiven] = NOT_GIVEN,
build_stack: Union[str, None, NotGiven] = NOT_GIVEN,
app_channel_discovery_enabled: Union[bool, NotGiven] = NOT_GIVEN,
next_app_build_number: Union[int, NotGiven] = NOT_GIVEN,
) -> App:
"""Update an app."""
"""Update an app.

``build_stack`` is the default stack for builds that do not specify one. Pass
``None`` to use the Capawesome Cloud default.
"""
body = build_body(
{
"name": name,
"type": type,
"appChannelId": app_channel_id,
"appEnvironmentId": app_environment_id,
"buildStack": build_stack,
"appChannelDiscoveryEnabled": app_channel_discovery_enabled,
"nextAppBuildNumber": next_app_build_number,
}
Expand Down
10 changes: 10 additions & 0 deletions tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ def test_update_with_no_args_sends_empty_body(client: CapawesomeCloud) -> None:
assert route.calls.last.request.read() == b"{}"


@respx.mock
def test_app_update_sends_build_stack(client: CapawesomeCloud) -> None:
route = respx.patch(f"{BASE_URL}/v1/apps/app1").mock(
return_value=httpx.Response(200, json={"id": "app1", "buildStack": "macos-tahoe"})
)
app = client.apps.update("app1", build_stack="macos-tahoe")
assert route.calls.last.request.read() == b'{"buildStack":"macos-tahoe"}'
assert app.build_stack == "macos-tahoe"


@respx.mock
def test_pause_channel_no_content(client: CapawesomeCloud) -> None:
route = respx.post(f"{BASE_URL}/v1/apps/app1/channels/ch1/pause").mock(
Expand Down
Loading