summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2013-01-10 08:09:24 +0100
committerMartin Pitt <martinpitt@gnome.org>2013-01-10 08:10:14 +0100
commit4cd213d4db7c77de6788cb8d790babcc0dd6daa0 (patch)
treec77e743b4e985636242df331612774a91c080c0c /test
parent552002b6e567399e837f343885ff40866364b50a (diff)
downloadgvfs-4cd213d4db7c77de6788cb8d790babcc0dd6daa0.tar.gz
gvfs-test: Add system partition Drive test with Gio API
This allows us to check further properties such as UUIDs.
Diffstat (limited to 'test')
-rwxr-xr-xtest/gvfs-test35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/gvfs-test b/test/gvfs-test
index b23e0f78..1fb86d73 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -1085,6 +1085,41 @@ class Drive(GvfsTestCase):
# unmount it again
self.unmount(match.group(1))
+ def test_system_partition_api(self):
+ '''drive mount: system partition with Gio API'''
+
+ self.load_image('vfat.img.bz2')
+
+ self.start_polkit(['org.freedesktop.udisks2.filesystem-mount-system'])
+
+ self.volume = None
+
+ # add partition and wait for it to appear in the monitor
+ def volume_added(vm, v, main_loop):
+ if v.get_name() == 'testvfat':
+ self.volume = v
+ main_loop.quit()
+
+ vm = Gio.VolumeMonitor.get()
+ ml = GLib.MainLoop()
+ vm.connect('volume-added', volume_added, ml)
+
+ dev = self.create_host(PTYPE_DISK)
+ timeout_id = GLib.timeout_add_seconds(5, lambda data: ml.quit(), None)
+ ml.run()
+ self.assertNotEqual(self.volume, None,
+ 'timed out waiting for volume')
+ ml.get_context().find_source_by_id(timeout_id).destroy()
+
+ # check properties
+ ids = self.volume.enumerate_identifiers()
+ self.assertTrue('unix-device' in ids, ids)
+ self.assertTrue('label' in ids, ids)
+ self.assertTrue('uuid' in ids, ids)
+ self.assertEqual(self.volume.get_identifier('unix-device'), '/dev/' + dev)
+ self.assertEqual(self.volume.get_identifier('label'), 'testvfat')
+ self.assertEqual(self.volume.get_identifier('uuid'), 'F3C1-6301')
+
def test_media_player(self):
'''drive mount: media player'''