Skip to content

Commit

Permalink
Revert "tests: Remove resolve_device tests involving partition creation"
Browse files Browse the repository at this point in the history
This reverts commit 3c41385.
  • Loading branch information
tbzatek committed Nov 7, 2022
1 parent 773e030 commit 0bfc558
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/tests/dbus-tests/test_10_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,34 @@ def test_60_resolve_device(self):
self.assertEqual(len(devices), 1)
self.assertIn(object_path, devices)

# create a partition on another device
disk = self.get_object('/block_devices/' + os.path.basename(self.vdevs[2]))
self.assertIsNotNone(disk)
disk.Format('gpt', self.no_options, dbus_interface=self.iface_prefix + '.Block')
self.addCleanup(self._wipe, self.vdevs[2])
part_label = 'PRTLBLX'
path = disk.CreatePartition(dbus.UInt64(1024**2), dbus.UInt64(100 * 1024**2),
'', part_label, self.no_options,
dbus_interface=self.iface_prefix + '.PartitionTable')
part = self.bus.get_object(self.iface_prefix, path)
self.assertIsNotNone(part)
part_uuid = self.get_property_raw(part, '.Partition', 'UUID')
self.assertIsNotNone(part_uuid)
part_name_val = self.get_property_raw(part, '.Partition', 'Name')
self.assertEquals(part_name_val, part_label)

# check that partlabel and partuuid can be resolved
spec = dbus.Dictionary({'partlabel': part_label}, signature='sv')
devices = manager.ResolveDevice(spec, self.no_options)
object_path = '%s/block_devices/%s1' % (self.path_prefix, os.path.basename(self.vdevs[2]))
self.assertEqual(len(devices), 1)
self.assertIn(object_path, devices)
spec = dbus.Dictionary({'partuuid': part_uuid}, signature='sv')
devices = manager.ResolveDevice(spec, self.no_options)
object_path = '%s/block_devices/%s1' % (self.path_prefix, os.path.basename(self.vdevs[2]))
self.assertEqual(len(devices), 1)
self.assertIn(object_path, devices)

def test_80_device_presence(self):
'''Test the debug devices are present on the bus'''
for d in self.vdevs:
Expand Down

0 comments on commit 0bfc558

Please sign in to comment.