diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/registry/registry.i | 3 | ||||
-rw-r--r-- | source4/lib/registry/registry.py | 1 | ||||
-rw-r--r-- | source4/lib/registry/registry_wrap.c | 101 | ||||
-rw-r--r-- | source4/param/param.i | 23 | ||||
-rw-r--r-- | source4/param/param.py | 13 | ||||
-rw-r--r-- | source4/param/param_wrap.c | 67 | ||||
-rw-r--r-- | source4/param/tests/bindings.py | 41 | ||||
-rwxr-xr-x | source4/selftest/samba4_tests.sh | 1 |
8 files changed, 150 insertions, 100 deletions
diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 330f0856e1..ef823dddbd 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -25,6 +25,7 @@ #include "includes.h" #include "registry.h" +#include "param/param.h" typedef struct registry_context reg; typedef struct hive_key hive; @@ -39,6 +40,7 @@ typedef struct hive_key hive; %import "../../lib/talloc/talloc.i" %import "../../auth/credentials/credentials.i" %import "../../libcli/util/errors.i" +%import "../../param/param.i" /* Utility functions */ @@ -123,6 +125,7 @@ typedef struct registry_context { WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, struct hive_key **root); typedef struct hive_key { diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index 4e3d48a18c..451b650d62 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -58,6 +58,7 @@ def _swig_setattr_nondynamic_method(set): import credentials +import param reg_get_predef_name = _registry.reg_get_predef_name str_regtype = _registry.str_regtype Registry = _registry.Registry diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index 15c27a8f6c..4f74072dc1 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2463,20 +2463,23 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_hive_key swig_types[4] #define SWIGTYPE_p_int swig_types[5] #define SWIGTYPE_p_loadparm_context swig_types[6] -#define SWIGTYPE_p_long_long swig_types[7] -#define SWIGTYPE_p_p_char swig_types[8] -#define SWIGTYPE_p_p_hive_key swig_types[9] -#define SWIGTYPE_p_p_registry_context swig_types[10] -#define SWIGTYPE_p_p_registry_key swig_types[11] -#define SWIGTYPE_p_registry_context swig_types[12] -#define SWIGTYPE_p_short swig_types[13] -#define SWIGTYPE_p_signed_char swig_types[14] -#define SWIGTYPE_p_unsigned_char swig_types[15] -#define SWIGTYPE_p_unsigned_int swig_types[16] -#define SWIGTYPE_p_unsigned_long_long swig_types[17] -#define SWIGTYPE_p_unsigned_short swig_types[18] -static swig_type_info *swig_types[20]; -static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0}; +#define SWIGTYPE_p_loadparm_service swig_types[7] +#define SWIGTYPE_p_long_long swig_types[8] +#define SWIGTYPE_p_p_char swig_types[9] +#define SWIGTYPE_p_p_hive_key swig_types[10] +#define SWIGTYPE_p_p_registry_context swig_types[11] +#define SWIGTYPE_p_p_registry_key swig_types[12] +#define SWIGTYPE_p_param_context swig_types[13] +#define SWIGTYPE_p_param_section swig_types[14] +#define SWIGTYPE_p_registry_context swig_types[15] +#define SWIGTYPE_p_short swig_types[16] +#define SWIGTYPE_p_signed_char swig_types[17] +#define SWIGTYPE_p_unsigned_char swig_types[18] +#define SWIGTYPE_p_unsigned_int swig_types[19] +#define SWIGTYPE_p_unsigned_long_long swig_types[20] +#define SWIGTYPE_p_unsigned_short swig_types[21] +static swig_type_info *swig_types[23]; +static swig_module_info swig_module = {swig_types, 22, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -2522,6 +2525,7 @@ static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0}; #include "includes.h" #include "registry.h" +#include "param/param.h" typedef struct registry_context reg; typedef struct hive_key hive; @@ -3244,7 +3248,8 @@ SWIGINTERN PyObject *_wrap_Hive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, char *arg2 = (char *) 0 ; struct auth_session_info *arg3 = (struct auth_session_info *) 0 ; struct cli_credentials *arg4 = (struct cli_credentials *) 0 ; - struct hive_key **arg5 = (struct hive_key **) 0 ; + struct loadparm_context *arg5 = (struct loadparm_context *) 0 ; + struct hive_key **arg6 = (struct hive_key **) 0 ; WERROR result; int res2 ; char *buf2 = 0 ; @@ -3253,12 +3258,15 @@ SWIGINTERN PyObject *_wrap_Hive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; - struct hive_key *tmp5 ; + void *argp5 = 0 ; + int res5 = 0 ; + struct hive_key *tmp6 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; char * kwnames[] = { - (char *) "location",(char *) "session_info",(char *) "credentials", NULL + (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL }; { @@ -3268,12 +3276,15 @@ SWIGINTERN PyObject *_wrap_Hive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, arg4 = NULL; } { + arg5 = loadparm_init(NULL); + } + { arg1 = NULL; } { - arg5 = &tmp5; + arg6 = &tmp6; } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:Hive",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:Hive",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Hive" "', argument " "2"" of type '" "char const *""'"); @@ -3293,7 +3304,14 @@ SWIGINTERN PyObject *_wrap_Hive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, } arg4 = (struct cli_credentials *)(argp4); } - result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5); + if (obj3) { + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Hive" "', argument " "5"" of type '" "struct loadparm_context *""'"); + } + arg5 = (struct loadparm_context *)(argp5); + } + result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6); { if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result)); @@ -3304,12 +3322,18 @@ SWIGINTERN PyObject *_wrap_Hive(PyObject *SWIGUNUSEDPARM(self), PyObject *args, } { Py_XDECREF(resultobj); - resultobj = SWIG_NewPointerObj(*arg5, SWIGTYPE_p_hive_key, 0); + resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0); } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + { + talloc_free(arg5); + } return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + { + talloc_free(arg5); + } return NULL; } @@ -3384,6 +3408,9 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * }; { + arg3 = loadparm_init(NULL); + } + { arg4 = NULL; } { @@ -3395,12 +3422,14 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * { arg2 = &tmp2; } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; - res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'"); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (obj0) { + res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'"); + } + arg3 = (struct loadparm_context *)(argp3); } - arg3 = (struct loadparm_context *)(argp3); if (obj1) { res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_auth_session_info, 0 | 0 ); if (!SWIG_IsOK(res4)) { @@ -3427,8 +3456,14 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * { resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_registry_context, 0); } + { + talloc_free(arg3); + } return resultobj; fail: + { + talloc_free(arg3); + } return NULL; } @@ -3463,12 +3498,15 @@ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_hive_key = {"_p_hive_key", "struct hive_key *|hive *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_hive_key = {"_p_p_hive_key", "struct hive_key **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_registry_context = {"_p_p_registry_context", "struct registry_context **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_registry_key = {"_p_p_registry_key", "struct registry_key **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_registry_context = {"_p_registry_context", "struct registry_context *|reg *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0}; @@ -3485,11 +3523,14 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_hive_key, &_swigt__p_int, &_swigt__p_loadparm_context, + &_swigt__p_loadparm_service, &_swigt__p_long_long, &_swigt__p_p_char, &_swigt__p_p_hive_key, &_swigt__p_p_registry_context, &_swigt__p_p_registry_key, + &_swigt__p_param_context, + &_swigt__p_param_section, &_swigt__p_registry_context, &_swigt__p_short, &_swigt__p_signed_char, @@ -3506,11 +3547,14 @@ static swig_cast_info _swigc__p_cli_credentials[] = { {&_swigt__p_cli_credentia static swig_cast_info _swigc__p_hive_key[] = { {&_swigt__p_hive_key, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_hive_key[] = { {&_swigt__p_p_hive_key, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_registry_context[] = { {&_swigt__p_p_registry_context, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_registry_key[] = { {&_swigt__p_p_registry_key, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_registry_context[] = { {&_swigt__p_registry_context, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}}; @@ -3527,11 +3571,14 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_hive_key, _swigc__p_int, _swigc__p_loadparm_context, + _swigc__p_loadparm_service, _swigc__p_long_long, _swigc__p_p_char, _swigc__p_p_hive_key, _swigc__p_p_registry_context, _swigc__p_p_registry_key, + _swigc__p_param_context, + _swigc__p_param_section, _swigc__p_registry_context, _swigc__p_short, _swigc__p_signed_char, diff --git a/source4/param/param.i b/source4/param/param.i index aadca9b1fb..ca1bb69184 100644 --- a/source4/param/param.i +++ b/source4/param/param.i @@ -40,12 +40,11 @@ typedef struct param_section param_section; $1 = loadparm_init(NULL); } -%typemap(freearg) struct loadparm_context * { - talloc_free($1); -} - %rename(LoadParm) loadparm_context; +%nodefaultctor loadparm_context; +%nodefaultdtor loadparm_context; + typedef struct loadparm_context { %extend { loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); } @@ -85,13 +84,27 @@ typedef struct param_context { int use(struct param_context *); int write(const char *fn); } + %pythoncode { + def __getitem__(self, name): + ret = self.get_section(name) + if ret is None: + raise KeyError("No such section %s" % name) + return ret + } } param; typedef struct param_section { %extend { struct param_opt *get(const char *name); } + %pythoncode { + def __getitem__(self, name): + ret = self.get_section(name) + if ret is None: + raise KeyError("No such section %s" % name) + return ret + } } param_section; %rename(default_config) global_loadparm; -struct loadparm_context *global_loadparm; +//struct loadparm_context *global_loadparm ; diff --git a/source4/param/param.py b/source4/param/param.py index 6b90581c68..8ac009af96 100644 --- a/source4/param/param.py +++ b/source4/param/param.py @@ -88,6 +88,12 @@ class ParamFile(object): def __init__(self, *args, **kwargs): _param.ParamFile_swiginit(self,_param.new_ParamFile(*args, **kwargs)) __swig_destroy__ = _param.delete_ParamFile + def __getitem__(self, name): + ret = self.get_section(name) + if ret is None: + raise KeyError("No such section %s" % name) + return ret + ParamFile.get_section = new_instancemethod(_param.ParamFile_get_section,None,ParamFile) ParamFile.get = new_instancemethod(_param.ParamFile_get,None,ParamFile) ParamFile.set_string = new_instancemethod(_param.ParamFile_set_string,None,ParamFile) @@ -100,6 +106,12 @@ ParamFile_swigregister(ParamFile) class param_section(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr + def __getitem__(self, name): + ret = self.get_section(name) + if ret is None: + raise KeyError("No such section %s" % name) + return ret + def __init__(self, *args, **kwargs): _param.param_section_swiginit(self,_param.new_param_section(*args, **kwargs)) __swig_destroy__ = _param.delete_param_section @@ -108,5 +120,4 @@ param_section_swigregister = _param.param_section_swigregister param_section_swigregister(param_section) -cvar = _param.cvar diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c index 9f65ba6f88..704759ad19 100644 --- a/source4/param/param_wrap.c +++ b/source4/param/param_wrap.c @@ -2689,14 +2689,8 @@ SWIGINTERN PyObject *_wrap_delete_LoadParm(PyObject *SWIGUNUSEDPARM(self), PyObj delete_loadparm_context(arg1); resultobj = SWIG_Py_Void(); - { - talloc_free(arg1); - } return resultobj; fail: - { - talloc_free(arg1); - } return NULL; } @@ -2737,15 +2731,9 @@ SWIGINTERN PyObject *_wrap_LoadParm_load(PyObject *SWIGUNUSEDPARM(self), PyObjec } result = (bool)loadparm_context_load(arg1,(char const *)arg2); resultobj = SWIG_From_bool((bool)(result)); - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } @@ -2775,14 +2763,8 @@ SWIGINTERN PyObject *_wrap_LoadParm___len__(PyObject *SWIGUNUSEDPARM(self), PyOb } result = (int)loadparm_context___len__(arg1); resultobj = SWIG_From_int((int)(result)); - { - talloc_free(arg1); - } return resultobj; fail: - { - talloc_free(arg1); - } return NULL; } @@ -2823,15 +2805,9 @@ SWIGINTERN PyObject *_wrap_LoadParm___getitem__(PyObject *SWIGUNUSEDPARM(self), } result = (struct loadparm_service *)loadparm_context___getitem__(arg1,(char const *)arg2); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_loadparm_service, 0 | 0 ); - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } @@ -2861,14 +2837,8 @@ SWIGINTERN PyObject *_wrap_LoadParm_configfile(PyObject *SWIGUNUSEDPARM(self), P } result = (char *)loadparm_context_configfile(arg1); resultobj = SWIG_FromCharPtr((const char *)result); - { - talloc_free(arg1); - } return resultobj; fail: - { - talloc_free(arg1); - } return NULL; } @@ -2909,15 +2879,9 @@ SWIGINTERN PyObject *_wrap_LoadParm_is_mydomain(PyObject *SWIGUNUSEDPARM(self), } result = (bool)loadparm_context_is_mydomain(arg1,(char const *)arg2); resultobj = SWIG_From_bool((bool)(result)); - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } @@ -2959,15 +2923,9 @@ SWIGINTERN PyObject *_wrap_LoadParm_is_myname(PyObject *SWIGUNUSEDPARM(self), Py } result = (bool)loadparm_context_is_myname(arg1,(char const *)arg2); resultobj = SWIG_From_bool((bool)(result)); - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: - { - talloc_free(arg1); - } if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } @@ -3450,29 +3408,6 @@ SWIGINTERN PyObject *param_section_swiginit(PyObject *SWIGUNUSEDPARM(self), PyOb return SWIG_Python_InitShadowInstance(args); } -SWIGINTERN int Swig_var_default_config_set(PyObject *_val) { - { - void *argp = 0; - int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_loadparm_context, 0 ); - if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "in variable '""global_loadparm""' of type '""struct loadparm_context *""'"); - } - global_loadparm = (struct loadparm_context *)(argp); - } - return 0; -fail: - return 1; -} - - -SWIGINTERN PyObject *Swig_var_default_config_get(void) { - PyObject *pyobj = 0; - - pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(global_loadparm), SWIGTYPE_p_loadparm_context, 0 ); - return pyobj; -} - - static PyMethodDef SwigMethods[] = { { (char *)"new_LoadParm", (PyCFunction)_wrap_new_LoadParm, METH_NOARGS, NULL}, { (char *)"delete_LoadParm", (PyCFunction) _wrap_delete_LoadParm, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -4095,7 +4030,5 @@ SWIGEXPORT void SWIG_init(void) { SWIG_InstallConstants(d,swig_const_table); - PyDict_SetItemString(d,(char*)"cvar", SWIG_globals()); - SWIG_addvarlink(SWIG_globals(),(char*)"default_config",Swig_var_default_config_get, Swig_var_default_config_set); } diff --git a/source4/param/tests/bindings.py b/source4/param/tests/bindings.py new file mode 100644 index 0000000000..ea542e2187 --- /dev/null +++ b/source4/param/tests/bindings.py @@ -0,0 +1,41 @@ +#!/usr/bin/python + +# Unix SMB/CIFS implementation. +# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +import param +import unittest + +class LoadParmTestCase(unittest.TestCase): + def test_init(self): + file = param.LoadParm() + self.assertTrue(file is not None) + + def test_lenght(self): + file = param.LoadParm() + self.assertEquals(0, len(file)) + + +class ParamTestCase(unittest.TestCase): + def test_init(self): + file = param.ParamFile() + self.assertTrue(file is not None) + + def test_get_section(self): + file = param.ParamFile() + self.assertEquals(None, file.get_section("unknown")) + self.assertRaises(KeyError, lambda: file["unknown"]) diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 9043de72d4..424e1f0209 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -300,4 +300,5 @@ then plantest "tdb.python" none PYTHONPATH=bin/python:scripting/python:lib/tdb/python/tests scripting/bin/subunitrun simple plantest "auth.python" none PYTHONPATH=bin/python:scripting/python:auth/tests/ scripting/bin/subunitrun bindings plantest "security.python" none PYTHONPATH=bin/python:scripting/python:libcli/security/tests/ scripting/bin/subunitrun bindings + plantest "param.python" none PYTHONPATH=bin/python:scripting/python:param/tests scripting/bin/subunitrun bindings fi |