summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-08-01 22:13:07 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-01 22:13:07 +0000
commitbd788d5972dc5d1896820740061bbc9250d80682 (patch)
tree650153daac57fef9cfa2a07a8cb6ae8d1829d8d5 /tests
parent3a4235b39c68512f78ab93c9e0cc05b3588c07d5 (diff)
downloadpygobject-bd788d5972dc5d1896820740061bbc9250d80682.tar.gz
Wrap gio.File.move
2008-08-02 Johan Dahlin <johan@gnome.org> * gio/gio.defs: * gio/gfile.override: * tests/test_gio.py: Wrap gio.File.move svn path=/trunk/; revision=908
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gio.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py
index d4054de2..5a3715b4 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -13,7 +13,8 @@ class TestFile(unittest.TestCase):
def tearDown(self):
self._f.close()
- os.unlink("file.txt")
+ if os.path.exists('file.txt'):
+ os.unlink("file.txt")
def testReadAsync(self):
self._f.write("testing")
@@ -159,6 +160,33 @@ class TestFile(unittest.TestCase):
finally:
os.unlink("copy.txt")
+ def testMove(self):
+ if os.path.exists('move.txt'):
+ os.unlink("move.txt")
+
+ source = gio.File('file.txt')
+ destination = gio.File('move.txt')
+ retval = source.move(destination)
+ self.failUnless(retval)
+
+ self.failIf(os.path.exists('file.txt'))
+ self.failUnless(os.path.exists('move.txt'))
+
+ self.called = False
+ def callback(current, total):
+ self.called = True
+ source = gio.File('move.txt')
+ destination = gio.File('move-2.txt')
+ try:
+ retval = source.move(destination, callback)
+ self.failUnless(retval)
+
+ self.failIf(os.path.exists('move.txt'))
+ self.failUnless(os.path.exists('move-2.txt'))
+ self.failUnless(self.called)
+ finally:
+ os.unlink("move-2.txt")
+
def testInfoList(self):
infolist = self.file.query_settable_attributes()
for info in infolist: