1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-27 07:42:04 +03:00

python/samba/tests: make sure samba.tests can be imported without SamDB

We are using samba.tests Python module __init__.py file as a catch-all
for all types of helpers. Some of these helpers are only usable with
Samba AD DC targets.

When SamDB is not available in a non-Samba AD DC target, provide a
dummy replacement that simply returns None. This allows to complete
initialization for non-Samba AD DC target tests which do not use
connect_samdb() helper.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Jul 23 19:36:56 CEST 2018 on sn-devel-144
This commit is contained in:
Alexander Bokovoy
2018-07-21 12:05:15 +03:00
committed by Günther Deschner
parent 1faaeb00b5
commit 6de9d878b5

View File

@ -38,7 +38,12 @@ import samba.dcerpc.base
from samba.compat import PY3, text_type from samba.compat import PY3, text_type
from samba.compat import string_types from samba.compat import string_types
from random import randint from random import randint
try:
from samba.samdb import SamDB from samba.samdb import SamDB
except ImportError:
# We are built without samdb support,
# imitate it so that connect_samdb() can recover
SamDB = lambda *x: None
import samba.ndr import samba.ndr
import samba.dcerpc.dcerpc import samba.dcerpc.dcerpc
import samba.dcerpc.epmapper import samba.dcerpc.epmapper