Beispiel #1
0
 def make_view(self, *, info):
     dev_info = create_test_instance(NetDevInfo)
     base_view = BaseView(urwid.Text(""))
     base_view.controller = mock.Mock()
     base_view.controller.get_info_for_netdev.return_value = "INFO"
     stretchy = ViewInterfaceInfo(base_view, dev_info)
     base_view.show_stretchy_overlay(stretchy)
     return base_view, stretchy
Beispiel #2
0
def make_format_entire_view(model, disk):
    controller = mock.create_autospec(spec=FilesystemController)
    base_view = BaseView(urwid.Text(""))
    base_view.model = model
    base_view.controller = controller
    base_view.refresh_model_inputs = lambda: None
    stretchy = FormatEntireStretchy(base_view, disk)
    base_view.show_stretchy_overlay(stretchy)
    return base_view, stretchy
Beispiel #3
0
def make_partition_view(model, disk, partition=None):
    controller = mock.create_autospec(spec=FilesystemController)
    base_view = BaseView(urwid.Text(""))
    base_view.model = model
    base_view.controller = controller
    base_view.refresh_model_inputs = lambda: None
    stretchy = PartitionStretchy(base_view, disk, partition)
    base_view.show_stretchy_overlay(stretchy)
    return base_view, stretchy
Beispiel #4
0
def make_view(model, existing=None):
    controller = mock.create_autospec(spec=FilesystemController)
    base_view = BaseView(urwid.Text(""))
    base_view.model = model
    base_view.controller = controller
    base_view.refresh_model_inputs = lambda: None
    stretchy = RaidStretchy(base_view, existing)
    base_view.show_stretchy_overlay(stretchy)
    return base_view, stretchy
 def make_view(self):
     device = mock.create_autospec(spec=NetworkDev)
     device.config = {}
     base_view = BaseView(urwid.Text(""))
     base_view.update_link = lambda device: None
     base_view.controller = mock.create_autospec(spec=NetworkController)
     stretchy = EditNetworkStretchy(base_view, device, 4)
     base_view.show_stretchy_overlay(stretchy)
     stretchy.method_form.method.value = "manual"
     return base_view, stretchy
Beispiel #6
0
 def make_view(self, dev_info=None):
     if dev_info is None:
         dev_info = create_test_instance(
             NetDevInfo, overrides={'static4.addresses': ['1.2.3.4/5']})
     base_view = BaseView(urwid.Text(""))
     base_view.update_link = lambda device: None
     base_view.controller = mock.create_autospec(spec=NetworkController)
     stretchy = EditNetworkStretchy(base_view, dev_info, 4)
     base_view.show_stretchy_overlay(stretchy)
     stretchy.method_form.method.value = "manual"
     return base_view, stretchy
Beispiel #7
0
 def make_view(self, partition=None):
     controller = mock.create_autospec(spec=FilesystemController)
     model = mock.create_autospec(spec=FilesystemModel)
     model.fs_by_name = FilesystemModel.fs_by_name
     disk = Disk.from_info(
         FakeStorageInfo(name='disk-name',
                         size=100 * (2**20),
                         free=50 * (2**20)))
     base_view = BaseView(urwid.Text(""))
     base_view.model = model
     base_view.controller = controller
     base_view.refresh_model_inputs = lambda: None
     stretchy = PartitionStretchy(base_view, disk, partition)
     base_view.show_stretchy_overlay(stretchy)
     return base_view, stretchy