diff options
Diffstat (limited to 'tests/test_gio.py')
-rw-r--r-- | tests/test_gio.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index bac9cfc..2d39220 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -124,6 +124,37 @@ class TestFile(unittest.TestCase): loop = gobject.MainLoop() loop.run() + def testCopy(self): + if os.path.exists('copy.txt'): + os.unlink("copy.txt") + + source = gio.File('file.txt') + destination = gio.File('copy.txt') + try: + retval = source.copy(destination) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + finally: + os.unlink("copy.txt") + + self.called = False + def callback(current, total): + self.called = True + source = gio.File('file.txt') + destination = gio.File('copy.txt') + try: + retval = source.copy(destination, callback) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + self.failUnless(self.called) + finally: + os.unlink("copy.txt") class TestGFileEnumerator(unittest.TestCase): def setUp(self): |