diff options
author | Thiago da Silva <thiago@redhat.com> | 2014-03-26 16:31:28 -0400 |
---|---|---|
committer | Thiago da Silva <thiago@redhat.com> | 2014-03-27 15:21:50 -0400 |
commit | bd683d93cb8d967f761d53f7a6b4243eb8eaedea (patch) | |
tree | 5f73d7390690a9de7e3bf2371fb6590d5ecce95b /test/functional | |
parent | f50cec44586e851c3d9e29dd59574696ae6f0c3a (diff) |
adding new apis requested from gluster-swift proj
This patch adds new functions that are used in gluster-swift.
These functions are: dup, lseek, getatime, getctime, getmtime
Change-Id: I09036f7e393a89e09913f7f6de173e1eca8dca95
Signed-off-by: Thiago da Silva <thiago@redhat.com>
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/libgfapi-python-tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/libgfapi-python-tests.py b/test/functional/libgfapi-python-tests.py index ac5c38f..baad035 100644 --- a/test/functional/libgfapi-python-tests.py +++ b/test/functional/libgfapi-python-tests.py @@ -78,6 +78,7 @@ class FileOpsTest(unittest.TestCase): self.assertEqual(rc, len(self.data)) ret = fd.fsync() self.assertEqual(ret, 0) + self.assertEqual(fd.originalpath, self.path) def tearDown(self): self.path = None @@ -110,6 +111,29 @@ class FileOpsTest(unittest.TestCase): g.close() self.fail("Expected a OSError with errno.EEXIST") + def test_write_file_dup_lseek_read(self): + try: + f = self.vol.open("dune", os.O_CREAT | os.O_EXCL | os.O_RDWR) + f.write("I must not fear. Fear is the mind-killer.") + fdup = f.dup() + self.assertTrue(isinstance(fdup, gfapi.File)) + f.close() + ret = fdup.lseek(0, os.SEEK_SET) + self.assertEqual(ret, 0) + + buf = fdup.read(15) + self.assertEqual(buf.value, "I must not fear") + + ret = fdup.lseek(29, os.SEEK_SET) + self.assertEqual(ret, 29) + + buf = fdup.read(11) + self.assertEqual(buf.value, "mind-killer") + + fdup.close() + except OSError as e: + self.fail(e.message) + def test_exists(self): e = self.vol.exists(self.path) self.assertTrue(e) |