diff options
author | Prashanth Pai <ppai@redhat.com> | 2015-06-14 23:57:42 +0530 |
---|---|---|
committer | Thiago da Silva <thiago@redhat.com> | 2015-06-18 05:52:33 -0700 |
commit | ddbd7b570d0a9f599b417a499c912c5b13a003c9 (patch) | |
tree | 2dca993a300775af2367978c94ac34d7e332e3a1 /test/unit/gluster/test_gfapi.py | |
parent | 509abefca5902e4f0decf40368a90265d1a598bd (diff) |
Add missing Path based operation APIs
* Added commonly used path based operations that were missing from
the Volume class.
* Fixed function prototypes at places where it should be ssize_t
and not size_t. This caused overflow error at times.
* Added doc strings wherever they were missing.
Change-Id: I6ce28038da3cd0f89ab075045bb4092dd95e21c4
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'test/unit/gluster/test_gfapi.py')
-rw-r--r-- | test/unit/gluster/test_gfapi.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/unit/gluster/test_gfapi.py b/test/unit/gluster/test_gfapi.py index 9fcfbf5..1463f76 100644 --- a/test/unit/gluster/test_gfapi.py +++ b/test/unit/gluster/test_gfapi.py @@ -562,7 +562,7 @@ class TestVolume(unittest.TestCase): mock_glfs_getxattr.return_value = -1 with patch("gluster.gfapi.api.glfs_getxattr", mock_glfs_getxattr): - self.assertRaises(IOError, self.vol.getxattr, "file.txt", + self.assertRaises(OSError, self.vol.getxattr, "file.txt", "key1", 32) def test_listdir_success(self): @@ -597,7 +597,8 @@ class TestVolume(unittest.TestCase): def test_listxattr_success(self): def mock_glfs_listxattr(fs, path, buf, buflen): - buf.raw = "key1\0key2\0" + if buf: + buf.raw = "key1\0key2\0" return 10 with patch("gluster.gfapi.api.glfs_listxattr", mock_glfs_listxattr): @@ -610,7 +611,7 @@ class TestVolume(unittest.TestCase): mock_glfs_listxattr.return_value = -1 with patch("gluster.gfapi.api.glfs_listxattr", mock_glfs_listxattr): - self.assertRaises(IOError, self.vol.listxattr, "file.txt") + self.assertRaises(OSError, self.vol.listxattr, "file.txt") def test_lstat_success(self): mock_glfs_lstat = Mock() @@ -823,7 +824,7 @@ class TestVolume(unittest.TestCase): with patch("gluster.gfapi.api.glfs_removexattr", mock_glfs_removexattr): - self.assertRaises(IOError, self.vol.removexattr, "file.txt", + self.assertRaises(OSError, self.vol.removexattr, "file.txt", "key1") def test_rmtree_success(self): @@ -940,7 +941,7 @@ class TestVolume(unittest.TestCase): mock_glfs_setxattr.return_value = -1 with patch("gluster.gfapi.api.glfs_setxattr", mock_glfs_setxattr): - self.assertRaises(IOError, self.vol.setxattr, "file.txt", + self.assertRaises(OSError, self.vol.setxattr, "file.txt", "key1", "hello", 5) def test_symlink_success(self): |