From eeacde18752c2cd83906532b72bcd7259f57e5ba Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 4 Sep 2012 17:15:11 +0200 Subject: [PATCH] integration-test: Add test case for mounting removable device This should only require the org.freedesktop.udisks2.filesystem-mount privilege, not -system. --- src/tests/integration-test | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/tests/integration-test b/src/tests/integration-test index 96f5955..8b9343b 100755 --- a/src/tests/integration-test +++ b/src/tests/integration-test @@ -251,7 +251,7 @@ class UDisksTestCase(unittest.TestCase): If cd is True, return the CD device, otherwise the hard disk device. ''' block = klass.udisks_block(partition, cd) - return klass.client.get_object(block.get_object_path()).get_property('filesystem') + return klass.client.get_object(block.get_object_path()).get_filesystem() @classmethod def blkid(klass, partition=None, device=None): @@ -1192,6 +1192,26 @@ class Polkit(UDisksTestCase, test_polkitd.PolkitTestCase): self.assertEqual(block.get_property('id-type'), 'ext4') self.assertEqual(block.get_property('id-label'), 'polkityes') + def test_removable_fs(self): + '''Create FS on removable drive (allowed)''' + + self.start_polkitd(['org.freedesktop.udisks2.filesystem-mount']) + + # the scsi_debug CD drive content is the same as for the HD drive, but + # udev does not know about this; so give it a nudge to re-probe + subprocess.call(['udevadm', 'trigger', '--action=change', + '--sysname-match=' + os.path.basename(self.cd_device)]) + self.sync() + self.sync() + + fs = self.udisks_filesystem(cd=True) + self.assertNotEqual(fs, None) + mount_path = fs.call_mount_sync(no_options, None) + self.assertTrue('/media/' in mount_path, mount_path) + + self.retry_busy(fs.call_unmount_sync, no_options, None) + self.client.settle() + # ---------------------------------------------------------------------------- if __name__ == '__main__': -- 2.7.4