Merge pull request #1348 from dbungert/remove-deprecated-guided

filesystem: drop deprecated v2 guided
This commit is contained in:
Dan Bungert 2022-07-12 15:11:46 -06:00 committed by GitHub
commit cecca212f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 34 deletions

View File

@ -255,11 +255,6 @@ 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: ...

View File

@ -391,12 +391,6 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
self.model.reset() self.model.reset()
return await self.v2_GET() return await self.v2_GET()
async def v2_deprecated_guided_POST(self, data: GuidedChoice) \
-> StorageResponseV2:
log.debug(data)
self.guided(GuidedChoiceV2.from_guided_choice(data))
return await self.v2_GET()
async def v2_guided_GET(self) -> GuidedStorageResponseV2: async def v2_guided_GET(self) -> GuidedStorageResponseV2:
"""Acquire a list of possible guided storage configuration scenarios. """Acquire a list of possible guided storage configuration scenarios.
Results are sorted by the size of the space potentially available to Results are sorted by the size of the space potentially available to

View File

@ -248,7 +248,7 @@ class TestBitlocker(TestAPI):
class TestFlow(TestAPI): class TestFlow(TestAPI):
@timeout(2) @timeout(2)
async def test_server_flow(self): async def test_serverish_flow(self):
async with start_server('examples/simple.json') as inst: async with start_server('examples/simple.json') as inst:
await inst.post('/locale', 'en_US.UTF-8') await inst.post('/locale', 'en_US.UTF-8')
keyboard = { keyboard = {
@ -262,10 +262,10 @@ class TestFlow(TestAPI):
await inst.post('/network') await inst.post('/network')
await inst.post('/proxy', '') await inst.post('/proxy', '')
await inst.post('/mirror', 'http://us.archive.ubuntu.com/ubuntu') await inst.post('/mirror', 'http://us.archive.ubuntu.com/ubuntu')
resp = await inst.get('/storage/guided')
disk_id = resp['disks'][0]['id'] resp = await inst.get('/storage/v2/guided')
choice = {"disk_id": disk_id} [reformat] = resp['possible']
await inst.post('/storage/v2/deprecated/guided', choice) await inst.post('/storage/v2/guided', {'target': reformat})
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')
@ -348,23 +348,17 @@ class TestFlow(TestAPI):
reset_resp = await inst.post('/storage/v2/reset') reset_resp = await inst.post('/storage/v2/reset')
self.assertEqual(orig_resp, reset_resp) self.assertEqual(orig_resp, reset_resp)
choice = {'disk_id': disk_id} resp = await inst.get('/storage/v2/guided')
guided_resp = await inst.post('/storage/v2/deprecated/guided', [reformat] = match(resp['possible'],
choice) _type='GuidedStorageTargetReformat')
await inst.post('/storage/v2/guided', {'target': reformat})
after_guided_resp = await inst.get('/storage/v2')
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(after_guided_resp, post_resp)
class TestGuided(TestAPI): class TestGuided(TestAPI):
@timeout()
async def test_deprecated_guided_v2(self):
async with start_server('examples/simple.json') as inst:
choice = {'disk_id': 'disk-sda'}
resp = await inst.post('/storage/v2/deprecated/guided', choice)
self.assertEqual(1, len(resp['disks']))
self.assertEqual('disk-sda', resp['disks'][0]['id'])
@timeout() @timeout()
async def test_guided_v2_reformat(self): async def test_guided_v2_reformat(self):
cfg = 'examples/win10-along-ubuntu.json' cfg = 'examples/win10-along-ubuntu.json'
@ -373,8 +367,7 @@ class TestGuided(TestAPI):
resp = await inst.get('/storage/v2/guided') resp = await inst.get('/storage/v2/guided')
[reformat] = match(resp['possible'], [reformat] = match(resp['possible'],
_type='GuidedStorageTargetReformat') _type='GuidedStorageTargetReformat')
data = {'target': reformat} resp = await inst.post('/storage/v2/guided', {'target': reformat})
resp = await inst.post('/storage/v2/guided', data)
self.assertEqual(reformat, resp['configured']['target']) self.assertEqual(reformat, resp['configured']['target'])
resp = await inst.get('/storage/v2') resp = await inst.get('/storage/v2')
[p1, p2] = resp['disks'][0]['partitions'] [p1, p2] = resp['disks'][0]['partitions']
@ -912,14 +905,15 @@ class TestTodos(TestAPI): # server indicators of required client actions
@timeout() @timeout()
async def test_todos_guided(self): async def test_todos_guided(self):
async with start_server('examples/simple.json') as inst: async with start_server('examples/simple.json') as inst:
disk_id = 'disk-sda'
resp = await inst.post('/storage/v2/reformat_disk', resp = await inst.post('/storage/v2/reformat_disk',
{'disk_id': disk_id}) {'disk_id': 'disk-sda'})
self.assertTrue(resp['need_root']) self.assertTrue(resp['need_root'])
self.assertTrue(resp['need_boot']) self.assertTrue(resp['need_boot'])
choice = {'disk_id': disk_id} resp = await inst.get('/storage/v2/guided')
resp = await inst.post('/storage/v2/deprecated/guided', choice) [reformat] = resp['possible']
await inst.post('/storage/v2/guided', {'target': reformat})
resp = await inst.get('/storage/v2')
self.assertFalse(resp['need_root']) self.assertFalse(resp['need_root'])
self.assertFalse(resp['need_boot']) self.assertFalse(resp['need_boot'])