def test_set_logging_err(self): v = Volume("host", "vol") v.fs = 12345 _m_set_logging = Mock(return_value=-1) with patch("gluster.gfapi.api.glfs_set_logging", _m_set_logging): self.assertRaises(LibgfapiException, v.set_logging, "/dev/null", 7) _m_set_logging.assert_called_once_with(v.fs, None, 7)