From: Martin Pitt Date: Tue, 4 Sep 2012 15:15:11 +0000 (+0200) Subject: integration-test: Add test case for mounting removable device X-Git-Tag: upstream/2.1.2~123^2~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eeacde18752c2cd83906532b72bcd7259f57e5ba;p=platform%2Fupstream%2Fudisks2.git integration-test: Add test case for mounting removable device This should only require the org.freedesktop.udisks2.filesystem-mount privilege, not -system. --- 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__':