summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorThiago da Silva <thiago@redhat.com>2015-02-23 07:29:01 -0800
committerGerrit Code Review <review@dev.gluster.org>2015-02-23 07:29:01 -0800
commit0973939a7a7edf4ae9464a1214cc239ed9f4ba29 (patch)
treef27f379be9f63e63e24ae97c33f44b2d3e5c7ffd /test/unit
parent88bc71ff92026d889125bc0c4b14b450e41e62c4 (diff)
parentb5a327eb9c0c1ec3f77a36676d6cc9878353ec1b (diff)
Merge "adding functions setfsuid and setfsgid"
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/gluster/test_gfapi.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/gluster/test_gfapi.py b/test/unit/gluster/test_gfapi.py
index 0d73a32..8451b51 100644
--- a/test/unit/gluster/test_gfapi.py
+++ b/test/unit/gluster/test_gfapi.py
@@ -803,6 +803,36 @@ class TestVolume(unittest.TestCase):
mock_unlink.assert_called_once_with("dir1/file")
mock_rmdir.assert_called_with("dir1")
+ def test_setfsuid_success(self):
+ mock_glfs_setfsuid = Mock()
+ mock_glfs_setfsuid.return_value = 0
+
+ with patch("glusterfs.gfapi.api.glfs_setfsuid", mock_glfs_setfsuid):
+ ret = self.vol.setfsuid(1000)
+ self.assertEquals(ret, 0)
+
+ def test_setfsuid_fail(self):
+ mock_glfs_setfsuid = Mock()
+ mock_glfs_setfsuid.return_value = -1
+
+ with patch("glusterfs.gfapi.api.glfs_setfsuid", mock_glfs_setfsuid):
+ self.assertRaises(OSError, self.vol.setfsuid, 1001)
+
+ def test_setfsgid_success(self):
+ mock_glfs_setfsgid = Mock()
+ mock_glfs_setfsgid.return_value = 0
+
+ with patch("glusterfs.gfapi.api.glfs_setfsgid", mock_glfs_setfsgid):
+ ret = self.vol.setfsgid(1000)
+ self.assertEquals(ret, 0)
+
+ def test_setfsgid_fail(self):
+ mock_glfs_setfsgid = Mock()
+ mock_glfs_setfsgid.return_value = -1
+
+ with patch("glusterfs.gfapi.api.glfs_setfsgid", mock_glfs_setfsgid):
+ self.assertRaises(OSError, self.vol.setfsgid, 1001)
+
def test_setxattr_success(self):
mock_glfs_setxattr = Mock()
mock_glfs_setxattr.return_value = 0