self.librados = CDLL('librados.so.2')
self.cluster = c_void_p()
self.rados_id = rados_id
- if rados_id and not isinstance(rados_id, str):
+ if rados_id is not None and not isinstance(rados_id, str):
raise TypeError('rados_id must be a string or None')
if conffile is not None and not isinstance(conffile, str):
raise TypeError('conffile must be a string or None')
+ if name is not None and not isinstance(name, str):
+ raise TypeError('name must be a string or None')
+ if clustername is not None and not isinstance(clustername, str):
+ raise TypeError('clustername must be a string or None')
if rados_id and name:
raise Error("Rados(): can't supply both rados_id and name")
if rados_id:
assert_raises(Error, Rados, conffile='', name='invalid')
assert_raises(Error, Rados, conffile='', name='bad.invalid')
+def test_rados_init_type_error():
+ assert_raises(TypeError, Rados, rados_id=u'admin')
+ assert_raises(TypeError, Rados, rados_id=u'')
+ assert_raises(TypeError, Rados, name=u'client.admin')
+ assert_raises(TypeError, Rados, name=u'')
+ assert_raises(TypeError, Rados, conffile=u'blah')
+ assert_raises(TypeError, Rados, conffile=u'')
+ assert_raises(TypeError, Rados, clusternaem=u'blah')
+ assert_raises(TypeError, Rados, clustername=u'')
+
def test_rados_init():
with Rados(conffile='', rados_id='admin'):
pass