Ejemplo n.º 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
Ejemplo n.º 2
0
 def make_view(self):
     device = mock.create_autospec(spec=Networkdev)
     device.configured_ip_addresses_for_version = lambda v: []
     base_view = BaseView(urwid.Text(""))
     base_view.update_link = lambda device: None
     stretchy = EditNetworkStretchy(base_view, device, 4)
     base_view.show_stretchy_overlay(stretchy)
     stretchy.method_form.method.value = "manual"
     return base_view, stretchy
 def make_view(self, *, info):
     device = mock.create_autospec(spec=NetworkDev)
     device.config = {}
     device.info = info
     device.type = "vlan"
     base_view = BaseView(urwid.Text(""))
     stretchy = ViewInterfaceInfo(base_view, device)
     base_view.show_stretchy_overlay(stretchy)
     return base_view, stretchy
Ejemplo n.º 4
0
    def test_basic(self):
        bv = BaseView(urwid.Text(""))
        s = TestStretchy()
        self.assertEqual(self.get_stretchy_chain(bv), [])
        bv.show_stretchy_overlay(s)
        self.assertTrue(s.was_opened)
        self.assertEqual(self.get_stretchy_chain(bv), [s])

        bv.remove_overlay()
        self.assertTrue(s.was_closed)
        self.assertEqual(self.get_stretchy_chain(bv), [])

        bv.show_stretchy_overlay(s)
        bv.remove_overlay(s)
        self.assertEqual(self.get_stretchy_chain(bv), [])
Ejemplo n.º 5
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
Ejemplo n.º 6
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
Ejemplo n.º 7
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
Ejemplo n.º 8
0
 def make_view_with_overlays(self):
     bv = BaseView(urwid.Text(""))
     a = TestStretchy()
     b = TestStretchy()
     c = TestStretchy()
     bv.show_stretchy_overlay(a)
     bv.show_stretchy_overlay(b)
     bv.show_stretchy_overlay(c)
     return bv, a, b, c
 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
Ejemplo n.º 10
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
Ejemplo n.º 11
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
Ejemplo n.º 12
0
 def make_view(self, *, info):
     base_view = BaseView(urwid.Text(""))
     stretchy = ViewInterfaceInfo(base_view, "nicname0", "INFO")
     base_view.show_stretchy_overlay(stretchy)
     return base_view, stretchy