sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #08182
Re: [Merge] ~ack/maas-site-manager:pending-sites-action into maas-site-manager:main
Diff comments:
> diff --git a/backend/msm/user_api/_schema.py b/backend/msm/user_api/_schema.py
> index af1da4f..f481522 100644
> --- a/backend/msm/user_api/_schema.py
> +++ b/backend/msm/user_api/_schema.py
> @@ -31,6 +31,13 @@ class CreateTokensResponse(BaseModel):
> tokens: list[UUID]
>
>
> +class PendingSitesActionRequest(BaseModel):
makes sense, will do in a separate MP
> + """Request to accept/reject sites."""
> +
> + ids: list[int]
> + accept: bool
> +
> +
> class PaginatedSites(PaginatedResults):
> items: list[Site]
>
> diff --git a/backend/tests/user_api/test_handlers.py b/backend/tests/user_api/test_handlers.py
> index a1301f0..e31c0bf 100644
> --- a/backend/tests/user_api/test_handlers.py
> +++ b/backend/tests/user_api/test_handlers.py
> @@ -290,6 +290,45 @@ async def test_list_pending_sites(
>
>
> @pytest.mark.asyncio
> +async def test_accept_pending_sites(
> + authenticated_user_app_client: AuthAsyncClient, fixture: Fixture
> +) -> None:
> + site = {
> + "name": "LondonHQ",
> + "url": "https://londoncalling.example.com",
> + "accepted": False,
> + }
> + [pending_site] = await fixture.create("site", [site])
> +
> + response = await authenticated_user_app_client.post(
> + "/requests",
> + json={"ids": [pending_site["id"]], "accept": True},
> + )
> + assert response.status_code == 204
> + [created_site] = await fixture.get("site")
> + assert created_site["accepted"]
> +
> +
> +@pytest.mark.asyncio
> +async def test_reject_pending_sites(
> + authenticated_user_app_client: AuthAsyncClient, fixture: Fixture
> +) -> None:
> + site = {
> + "name": "LondonHQ",
> + "url": "https://londoncalling.example.com",
> + "accepted": False,
> + }
> + [pending_site] = await fixture.create("site", [site])
> +
> + response = await authenticated_user_app_client.post(
> + "/requests",
> + json={"ids": [pending_site["id"]], "accept": False},
> + )
> + assert response.status_code == 204
> + assert await fixture.get("site") == []
> +
forgot to add it, added now. thanks
> +
> +@pytest.mark.asyncio
> @pytest.mark.parametrize("time_format", ["ISO 8601", "Float"])
> async def test_token_time_format(
> time_format: str, authenticated_user_app_client: AuthAsyncClient
--
https://code.launchpad.net/~ack/maas-site-manager/+git/site-manager/+merge/442472
Your team MAAS Committers is subscribed to branch ~ack/maas-site-manager:pending-sites-action.
References