summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-19 11:40:22 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-19 11:40:22 +0000
commit4d0b9fa9f506eb2888b51458668b6d7c542d8e08 (patch)
treee9a6be94877074509f149d4e6d121964f97d7899 /tests
parent629d93eae54072b0fea062c7e286ef932843add7 (diff)
downloadpygobject-4d0b9fa9f506eb2888b51458668b6d7c542d8e08.tar.gz
Bind gio.Mount.unmount, gio.File.mount_mountable,
2008-07-19 Johan Dahlin <johan@gnome.org> * gio/gfile.override: * gio/gio.defs: * gio/gio.override: * tests/test_gio.py: Bind gio.Mount.unmount, gio.File.mount_mountable, gio.File.unmount_mountable and gio.File.mount_enclosing_volume. Add documents and tests. svn path=/trunk/; revision=837
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 00ccb5af..bac9cfcc 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -90,6 +90,41 @@ class TestFile(unittest.TestCase):
loop = gobject.MainLoop()
loop.run()
+ def testMountMountable(self):
+ gfile = gio.File('localtest:')
+ def unmount_done(mount, result):
+ try:
+ retval = mount.unmount_finish(result)
+ self.failUnless(retval)
+ finally:
+ loop.quit()
+
+ def mount_enclosing_volume_done(gfile, result):
+ try:
+ try:
+ retval = gfile.mount_enclosing_volume_finish(result)
+ except gobject.GError, e:
+ # If we run the tests too fast
+ if (e.domain == gio.ERROR and
+ e.code == gio.ERROR_ALREADY_MOUNTED):
+ print ('WARNING: testfile is already mounted, '
+ 'skipping test')
+ loop.quit()
+ return
+ raise
+ self.failUnless(retval)
+ finally:
+ mount = gfile.find_enclosing_mount()
+ mount.unmount(unmount_done)
+
+ mount_operation = gio.MountOperation()
+ gfile.mount_enclosing_volume(mount_operation,
+ mount_enclosing_volume_done)
+
+ loop = gobject.MainLoop()
+ loop.run()
+
+
class TestGFileEnumerator(unittest.TestCase):
def setUp(self):
self.file = gio.File(".")
@@ -350,3 +385,4 @@ class TestAppInfo(unittest.TestCase):
def testSimple(self):
self.assertEquals(self.appinfo.get_description(),
"Custom definition for does-not-exist")
+