Ejemplo n.º 1
0
def make_model_and_disk():
    model = FilesystemModel(prober=None)
    disk = Disk.from_info(
        FakeStorageInfo(name='disk-name',
                        size=100 * (2**30),
                        free=50 * (2**30)))
    model._available_disks[disk.name] = disk
    return model, disk
Ejemplo n.º 2
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)))
     return PartitionView(model, controller, disk, partition)
Ejemplo n.º 3
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
     info = mock.create_autospec(spec=StorageInfo)
     info.name = 'disk-name'
     info.size = 100
     info.free = 50
     disk = Disk.from_info(info)
     return PartitionView(model, controller, disk, partition)
Ejemplo n.º 4
0
 def test_one_disk(self):
     disk = Disk.from_info(
         FakeStorageInfo(name='disk-name',
                         size=100 * (2**20),
                         free=50 * (2**20),
                         serial="DISK-SERIAL"))
     view = self.make_view([disk])
     w = view_helpers.find_with_pred(
         view,
         lambda w: isinstance(w, urwid.Text) and "DISK-SERIAL" in w.text)
     self.assertIsNotNone(w, "could not find DISK-SERIAL in view")
Ejemplo n.º 5
0
 def test_one_disk(self):
     model = mock.create_autospec(spec=FilesystemModel)
     disk = Disk.from_info(
         model,
         FakeStorageInfo(name='disk-name',
                         size=100 * (2**20),
                         free=50 * (2**20),
                         serial="DISK-SERIAL"))
     view = self.make_view(model, [disk])
     w = view_helpers.find_with_pred(
         view,
         lambda w: isinstance(w, urwid.Text) and "DISK-SERIAL" in w.text)
     self.assertIsNotNone(w, "could not find DISK-SERIAL in view")
Ejemplo n.º 6
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