integration-test: Add test case for mounting removable device
authorMartin Pitt <martinpitt@gnome.org>
Tue, 4 Sep 2012 15:15:11 +0000 (17:15 +0200)
committerMartin Pitt <martinpitt@gnome.org>
Tue, 4 Sep 2012 15:33:05 +0000 (17:33 +0200)
This should only require the org.freedesktop.udisks2.filesystem-mount
privilege, not -system.

src/tests/integration-test

index 96f5955..8b9343b 100755 (executable)
@@ -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__':