Py_RETURN_NONE;
}
+static PyObject *obj_drop(py_SMBConf_Object * self,
+ PyObject * Py_UNUSED(ignored))
+{
+ sbcErr err;
+
+ err = smbconf_drop(self->conf_ctx);
+ if (err != SBC_ERR_OK) {
+ py_raise_SMBConfError(err);
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
PyDoc_STRVAR(obj_requires_messaging_doc,
"requires_messaging() -> bool\n"
"\n"
"Create a new empty share in the configuration. The share\n"
"name must not exist or an error will be raised.\n");
+PyDoc_STRVAR(obj_drop_doc,
+"drop() -> None\n"
+"Drop the entire configuration, resetting it to an empty state.\n");
+
static PyMethodDef py_smbconf_obj_methods[] = {
{ "requires_messaging", (PyCFunction) obj_requires_messaging,
METH_NOARGS, obj_requires_messaging_doc },
obj_get_config_doc },
{ "create_share", (PyCFunction) obj_create_share, METH_VARARGS,
obj_create_share_doc },
+ { "drop", (PyCFunction) obj_drop, METH_NOARGS,
+ obj_drop_doc },
{ 0 },
};
def test_create_share(self):
sconf = self.s3smbconf.init_reg(None)
+ sconf.drop()
sconf.create_share("alice")
sconf.create_share("bob")
names = sconf.share_names()
self.smbconf.SMBConfError, sconf.create_share, "alice"
)
+ def test_create_share(self):
+ sconf = self.s3smbconf.init_reg(None)
+ sconf.drop()
+ sconf.create_share("alice")
+ sconf.drop()
+ names = sconf.share_names()
+ self.assertEqual(names, [])
+
if __name__ == "__main__":
import unittest