summaryrefslogtreecommitdiffstats
path: root/tests/test_gio.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gio.py')
-rw-r--r--tests/test_gio.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 1b91d2d..7f33137 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -70,7 +70,25 @@ class TestFile(unittest.TestCase):
self.assertEqual(cont, "testing load_contents")
self.assertEqual(leng, 21)
self.assertNotEqual(etag, '')
-
+
+ def testLoadContentsAsync(self):
+ self._f.write("testing load_contents_async")
+ self._f.seek(0)
+
+ def callback(contents, result):
+ try:
+ cont, leng, etag = contents.load_contents_finish(result)
+ self.assertEqual(cont, "testing load_contents_async")
+ self.assertEqual(leng, 27)
+ self.assertNotEqual(etag, '')
+ finally:
+ loop.quit()
+
+ canc = gio.Cancellable()
+ self.file.load_contents_async(callback, cancellable=canc)
+
+ loop = gobject.MainLoop()
+ loop.run()
class TestGFileEnumerator(unittest.TestCase):
def setUp(self):