filesystem: move v2 guided GET to deprecated

This commit is contained in:
Dan Bungert 2022-06-27 17:53:19 -06:00
parent 1ee323bb95
commit 1916f08342
3 changed files with 12 additions and 9 deletions

View File

@ -253,13 +253,14 @@ class API:
def GET() -> List[Disk]: ... def GET() -> List[Disk]: ...
class v2: class v2:
class deprecated:
class guided:
def POST(data: Payload[GuidedChoice]) \
-> StorageResponseV2: ...
def GET() -> StorageResponseV2: ... def GET() -> StorageResponseV2: ...
def POST() -> StorageResponseV2: ... def POST() -> StorageResponseV2: ...
class guided:
def POST(data: Payload[GuidedChoice]) \
-> StorageResponseV2: ...
class reset: class reset:
def POST() -> StorageResponseV2: ... def POST() -> StorageResponseV2: ...

View File

@ -342,7 +342,8 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
self.model.reset() self.model.reset()
return await self.v2_GET() 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) log.debug(data)
self.guided(data) self.guided(data)
return await self.v2_GET() return await self.v2_GET()

View File

@ -247,7 +247,7 @@ class TestFlow(TestAPI):
resp = await inst.get('/storage/guided') resp = await inst.get('/storage/guided')
disk_id = resp['disks'][0]['id'] disk_id = resp['disks'][0]['id']
choice = {"disk_id": disk_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.post('/storage/v2')
await inst.get('/meta/status', cur='WAITING') await inst.get('/meta/status', cur='WAITING')
await inst.post('/meta/confirm', tty='/dev/tty1') await inst.post('/meta/confirm', tty='/dev/tty1')
@ -331,7 +331,8 @@ class TestFlow(TestAPI):
self.assertEqual(orig_resp, reset_resp) self.assertEqual(orig_resp, reset_resp)
choice = {'disk_id': disk_id} 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') post_resp = await inst.post('/storage/v2')
# posting to the endpoint shouldn't change the answer # posting to the endpoint shouldn't change the answer
self.assertEqual(guided_resp, post_resp) self.assertEqual(guided_resp, post_resp)
@ -342,7 +343,7 @@ class TestGuided(TestAPI):
async def test_guided_v2(self): async def test_guided_v2(self):
async with start_server('examples/simple.json') as inst: async with start_server('examples/simple.json') as inst:
choice = {'disk_id': 'disk-sda'} 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(1, len(resp['disks']))
self.assertEqual('disk-sda', resp['disks'][0]['id']) 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']) self.assertTrue(resp['need_boot'])
choice = {'disk_id': disk_id} 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_root'])
self.assertFalse(resp['need_boot']) self.assertFalse(resp['need_boot'])