mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Initial work on a test for samba.tests.samdb
(This used to be commit 8b33860954
)
This commit is contained in:
parent
9f01303d15
commit
08e3f99f14
@ -50,4 +50,5 @@ RPC-FRSAPI # Not provided by Samba 4
|
|||||||
WINBIND # FIXME: This should not be skipped
|
WINBIND # FIXME: This should not be skipped
|
||||||
NSS-TEST # Fails
|
NSS-TEST # Fails
|
||||||
samba4.samba3sam.python # Conversion from EJS not yet finished
|
samba4.samba3sam.python # Conversion from EJS not yet finished
|
||||||
|
samba4.samdb.python # Not finished yet
|
||||||
RAW-OFFLINE # Samba 4 doesn't have much offline support yet
|
RAW-OFFLINE # Samba 4 doesn't have much offline support yet
|
||||||
|
@ -332,7 +332,6 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
|
|||||||
schemadn_ldb = "schema.ldb"
|
schemadn_ldb = "schema.ldb"
|
||||||
if ldap_backend is not None:
|
if ldap_backend is not None:
|
||||||
schema_ldb = ldap_backend
|
schema_ldb = ldap_backend
|
||||||
|
|
||||||
schemadn_ldb = ldap_backend
|
schemadn_ldb = ldap_backend
|
||||||
|
|
||||||
if ldap_backend_type == "fedora-ds":
|
if ldap_backend_type == "fedora-ds":
|
||||||
@ -536,6 +535,8 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
|
|||||||
:note: This will wipe the main SAM database file!
|
:note: This will wipe the main SAM database file!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
assert serverrole in ("domain controller", "member server")
|
||||||
|
|
||||||
# Also wipes the database
|
# Also wipes the database
|
||||||
setup_samdb_partitions(path, setup_path, schemadn=schemadn, configdn=configdn,
|
setup_samdb_partitions(path, setup_path, schemadn=schemadn, configdn=configdn,
|
||||||
domaindn=domaindn, message=message, lp=lp,
|
domaindn=domaindn, message=message, lp=lp,
|
||||||
|
55
source4/scripting/python/samba/tests/samdb.py
Normal file
55
source4/scripting/python/samba/tests/samdb.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# Unix SMB/CIFS implementation. Tests for SamDB
|
||||||
|
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
from auth import system_session
|
||||||
|
from credentials import Credentials
|
||||||
|
import os
|
||||||
|
from samba.provision import setup_samdb
|
||||||
|
from samba.samdb import SamDB
|
||||||
|
from samba.tests import get_loadparm, TestCaseInTempDir
|
||||||
|
import security
|
||||||
|
from unittest import TestCase
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
class SamDBTestCase(TestCaseInTempDir):
|
||||||
|
def setUp(self):
|
||||||
|
super(SamDBTestCase, self).setUp()
|
||||||
|
invocationid = uuid.random()
|
||||||
|
domaindn = "DC=COM,DC=EXAMPLE"
|
||||||
|
self.domaindn = domaindn
|
||||||
|
configdn = "CN=Configuration," + domaindn
|
||||||
|
schemadn = "CN=Schema," + configdn
|
||||||
|
domainguid = uuid.random()
|
||||||
|
policyguid = uuid.random()
|
||||||
|
setup_path = lambda x: os.path.join("setup", x)
|
||||||
|
creds = Credentials()
|
||||||
|
domainsid = security.random_sid()
|
||||||
|
hostguid = uuid.random()
|
||||||
|
path = os.path.join(self.tempdir, "samdb.ldb")
|
||||||
|
self.samdb = setup_samdb(path, setup_path, system_session(), creds,
|
||||||
|
get_loadparm(), schemadn, configdn,
|
||||||
|
self.domaindn, "example.com", "EXAMPLE.COM",
|
||||||
|
"FOO", lambda x: None, "foo", domaindn,
|
||||||
|
False, domainsid, "# no aci", domainguid,
|
||||||
|
policyguid, "EXAMPLE", True, "secret",
|
||||||
|
"secret", "secret", hostguid, invocationid,
|
||||||
|
"secret", "domain controller")
|
||||||
|
|
||||||
|
def test_add_foreign(self):
|
||||||
|
self.samdb.add_foreign(self.domaindn, "S-1-5-7", "Somedescription")
|
||||||
|
|
@ -320,6 +320,7 @@ then
|
|||||||
plantest "provision.python" none $SUBUNITRUN samba.tests.provision
|
plantest "provision.python" none $SUBUNITRUN samba.tests.provision
|
||||||
plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3
|
plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3
|
||||||
plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam
|
plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam
|
||||||
|
plantest "samdb.python" dc $SUBUNITRUN samba.tests.samdb
|
||||||
plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests
|
plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests
|
||||||
plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
|
plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
|
||||||
plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho
|
plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho
|
||||||
|
Loading…
Reference in New Issue
Block a user