From 1916f08342983309a09046732c5379bd6173e333 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Mon, 27 Jun 2022 17:53:19 -0600 Subject: [PATCH] filesystem: move v2 guided GET to deprecated --- subiquity/common/apidef.py | 9 +++++---- subiquity/server/controllers/filesystem.py | 3 ++- subiquity/tests/api/test_api.py | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/subiquity/common/apidef.py b/subiquity/common/apidef.py index b89c9e44..16f9bf42 100644 --- a/subiquity/common/apidef.py +++ b/subiquity/common/apidef.py @@ -253,13 +253,14 @@ class API: def GET() -> List[Disk]: ... class v2: + class deprecated: + class guided: + def POST(data: Payload[GuidedChoice]) \ + -> StorageResponseV2: ... + def GET() -> StorageResponseV2: ... def POST() -> StorageResponseV2: ... - class guided: - def POST(data: Payload[GuidedChoice]) \ - -> StorageResponseV2: ... - class reset: def POST() -> StorageResponseV2: ... diff --git a/subiquity/server/controllers/filesystem.py b/subiquity/server/controllers/filesystem.py index 08ef2002..c3092349 100644 --- a/subiquity/server/controllers/filesystem.py +++ b/subiquity/server/controllers/filesystem.py @@ -342,7 +342,8 @@ class FilesystemController(SubiquityController, FilesystemManipulator): self.model.reset() return await self.v2_GET() - async def v2_guided_POST(self, data: GuidedChoice) -> StorageResponseV2: + async def v2_deprecated_guided_POST(self, data: GuidedChoice) \ + -> StorageResponseV2: log.debug(data) self.guided(data) return await self.v2_GET() diff --git a/subiquity/tests/api/test_api.py b/subiquity/tests/api/test_api.py index b495aa3d..949307fe 100755 --- a/subiquity/tests/api/test_api.py +++ b/subiquity/tests/api/test_api.py @@ -247,7 +247,7 @@ class TestFlow(TestAPI): resp = await inst.get('/storage/guided') disk_id = resp['disks'][0]['id'] choice = {"disk_id": disk_id} - await inst.post('/storage/v2/guided', choice) + await inst.post('/storage/v2/deprecated/guided', choice) await inst.post('/storage/v2') await inst.get('/meta/status', cur='WAITING') await inst.post('/meta/confirm', tty='/dev/tty1') @@ -331,7 +331,8 @@ class TestFlow(TestAPI): self.assertEqual(orig_resp, reset_resp) choice = {'disk_id': disk_id} - guided_resp = await inst.post('/storage/v2/guided', choice) + guided_resp = await inst.post('/storage/v2/deprecated/guided', + choice) post_resp = await inst.post('/storage/v2') # posting to the endpoint shouldn't change the answer self.assertEqual(guided_resp, post_resp) @@ -342,7 +343,7 @@ class TestGuided(TestAPI): async def test_guided_v2(self): async with start_server('examples/simple.json') as inst: choice = {'disk_id': 'disk-sda'} - resp = await inst.post('/storage/v2/guided', choice) + resp = await inst.post('/storage/v2/deprecated/guided', choice) self.assertEqual(1, len(resp['disks'])) self.assertEqual('disk-sda', resp['disks'][0]['id']) @@ -772,7 +773,7 @@ class TestTodos(TestAPI): # server indicators of required client actions self.assertTrue(resp['need_boot']) choice = {'disk_id': disk_id} - resp = await inst.post('/storage/v2/guided', choice) + resp = await inst.post('/storage/v2/deprecated/guided', choice) self.assertFalse(resp['need_root']) self.assertFalse(resp['need_boot'])