summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/gluster/test_gfapi.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/gluster/test_gfapi.py b/test/unit/gluster/test_gfapi.py
index 5551235..4be2346 100644
--- a/test/unit/gluster/test_gfapi.py
+++ b/test/unit/gluster/test_gfapi.py
@@ -192,6 +192,17 @@ class TestFile(unittest.TestCase):
with patch("gluster.gfapi.File.fgetsize", _mock_fgetsize):
self.fd.read(buflen)
+ def test_readinto(self):
+ mock_glfs_read = Mock()
+ mock_glfs_read.return_value = 5
+
+ with patch("gluster.gfapi.api.glfs_read", mock_glfs_read):
+ buf = bytearray(10)
+ ret = self.fd.readinto(buf)
+ self.assertEqual(ret, 5)
+
+ self.assertRaises(TypeError, self.fd.readinto, str("hello"))
+
def test_write_success(self):
mock_glfs_write = Mock()
mock_glfs_write.return_value = 5