mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
Update after changes to the provision API, make sure temp dir gets cleaned
up.
(This used to be commit 064e9ddb37
)
This commit is contained in:
@ -16,13 +16,13 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
from auth import system_session
|
from samba.auth import system_session
|
||||||
from credentials import Credentials
|
from samba.credentials import Credentials
|
||||||
import os
|
import os
|
||||||
from samba.provision import setup_samdb
|
from samba.provision import setup_samdb, guess_names
|
||||||
from samba.samdb import SamDB
|
from samba.samdb import SamDB
|
||||||
from samba.tests import cmdline_loadparm, TestCaseInTempDir
|
from samba.tests import cmdline_loadparm, TestCaseInTempDir
|
||||||
import security
|
from samba import security
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -42,14 +42,23 @@ class SamDBTestCase(TestCaseInTempDir):
|
|||||||
domainsid = security.random_sid()
|
domainsid = security.random_sid()
|
||||||
hostguid = str(uuid.uuid4())
|
hostguid = str(uuid.uuid4())
|
||||||
path = os.path.join(self.tempdir, "samdb.ldb")
|
path = os.path.join(self.tempdir, "samdb.ldb")
|
||||||
|
names = guess_names(lp=cmdline_loadparm, hostname="foo",
|
||||||
|
domain="EXAMPLE.COM", dnsdomain="example.com",
|
||||||
|
serverrole="domain controller",
|
||||||
|
domaindn=self.domaindn, configdn=configdn,
|
||||||
|
schemadn=schemadn)
|
||||||
self.samdb = setup_samdb(path, setup_path, system_session(), creds,
|
self.samdb = setup_samdb(path, setup_path, system_session(), creds,
|
||||||
cmdline_loadparm, schemadn, configdn,
|
cmdline_loadparm, names,
|
||||||
self.domaindn, "example.com", "EXAMPLE.COM",
|
lambda x: None, domainsid,
|
||||||
"FOO", lambda x: None, "foo", domaindn,
|
"# no aci", domainguid,
|
||||||
False, domainsid, "# no aci", domainguid,
|
policyguid, False, "secret",
|
||||||
policyguid, "EXAMPLE", True, "secret",
|
"secret", "secret", invocationid,
|
||||||
"secret", "secret", hostguid, invocationid,
|
|
||||||
"secret", "domain controller")
|
"secret", "domain controller")
|
||||||
|
def tearDown(self):
|
||||||
|
for f in ['templates.ldb', 'schema.ldb', 'configuration.ldb',
|
||||||
|
'users.ldb', 'samdb.ldb']:
|
||||||
|
os.remove(os.path.join(self.tempdir, f))
|
||||||
|
super(SamDBTestCase, self).tearDown()
|
||||||
|
|
||||||
def test_add_foreign(self):
|
def test_add_foreign(self):
|
||||||
self.samdb.add_foreign(self.domaindn, "S-1-5-7", "Somedescription")
|
self.samdb.add_foreign(self.domaindn, "S-1-5-7", "Somedescription")
|
||||||
|
Reference in New Issue
Block a user