コード例 #1
0
 def test_create_raid(self):
     model, disk = make_model_and_disk()
     part1 = model.add_partition(disk, 10 * (2**30))
     part2 = model.add_partition(disk, 10 * (2**30))
     part3 = model.add_partition(disk, 10 * (2**30))
     view, stretchy = make_view(model)
     form_data = {
         'name': 'md0',
         'devices': {
             part1: 'active',
             part2: 'active',
             part3: 'spare'
         },
         'level': raidlevels_by_value[1],
     }
     expected_data = {
         'name': 'md0',
         'devices': {part1, part2},
         'spare_devices': {part3},
         'level': raidlevels_by_value[1],
     }
     view_helpers.enter_data(stretchy.form, form_data)
     view_helpers.click(stretchy.form.done_btn.base_widget)
     view.controller.raid_handler.assert_called_once_with(
         None, expected_data)
コード例 #2
0
 def test_create_vg_encrypted(self):
     model, disk = make_model_and_disk()
     part1 = model.add_partition(disk, 10 * (2**30))
     part2 = model.add_partition(disk, 10 * (2**30))
     view, stretchy = make_view(model)
     form_data = {
         'name': 'vg1',
         'devices': {
             part1: 'active',
             part2: 'active'
         },
         'encrypt': True,
         'password': '******',
         'confirm_password': '******',
     }
     expected_data = {
         'name': 'vg1',
         'devices': {part1, part2},
         'encrypt': True,
         'password': '******',
     }
     view_helpers.enter_data(stretchy.form, form_data)
     view_helpers.click(stretchy.form.done_btn.base_widget)
     view.controller.volgroup_handler.assert_called_once_with(
         None, expected_data)
コード例 #3
0
ファイル: test_raid.py プロジェクト: sd-hd/subiquity
 def test_edit_raid(self):
     model, disk = make_model_and_disk()
     part1 = model.add_partition(disk, 10*(2**30))
     part2 = model.add_partition(disk, 10*(2**30))
     raid = model.add_raid("md0", "raid1", {part1, part2}, set())
     view, stretchy = make_view(model, raid)
     form_data = {
         'name': 'md1',
         'level': raidlevels_by_value["raid0"],
         }
     expected_data = {
         'name': 'md1',
         'devices': {part1, part2},
         'spare_devices': set(),
         'level': raidlevels_by_value["raid0"],
         }
     view_helpers.enter_data(stretchy.form, form_data)
     view_helpers.click(stretchy.form.done_btn.base_widget)
     view.controller.raid_handler.assert_called_once_with(
         raid, expected_data)