From: David Mulder Date: Mon, 7 Dec 2020 14:39:00 +0000 (-0700) Subject: python: Test samdb import X-Git-Tag: tevent-0.11.0~1604 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5e39a836ae3ae8d8d9d338be67d2299390473be;p=thirdparty%2Fsamba.git python: Test samdb import Signed-off-by: David Mulder Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/imports.py b/python/samba/tests/imports.py new file mode 100644 index 00000000000..727f529ea9d --- /dev/null +++ b/python/samba/tests/imports.py @@ -0,0 +1,31 @@ +# Unix SMB/CIFS implementation. Tests for python imports +# Copyright (C) David Mulder 2020 +# +# 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 . +# +from samba.tests import TestCase + +class PyImportsTestCase(TestCase): + def setUp(self): + super().setUp() + + def tearDown(self): + super().tearDown() + + def test_samdb_import(self): + try: + from samba import dsdb, dsdb_dns + from samba import samdb + except ImportError as e: + self.fail('Failed to import samdb from samba: %s' % str(e)) diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo new file mode 100644 index 00000000000..05e6226bca7 --- /dev/null +++ b/selftest/knownfail.d/gpo @@ -0,0 +1 @@ +^samba.tests.imports diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index bc8fea83474..a0afe76e8d9 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -809,6 +809,10 @@ planoldpythontestsuite("ad_dc:local", "samba.tests.gpo", extra_args=['-U"$USERNA planoldpythontestsuite("ad_member", "samba.tests.gpo_member", extra_args=['-U"$USERNAME%$PASSWORD"']) planoldpythontestsuite("ad_dc:local", "samba.tests.dckeytab", extra_args=['-U"$USERNAME%$PASSWORD"']) +# Run the import test in environments that may not have the ad-dc built +for env in ['fileserver_smb1', 'nt4_member', 'clusteredmember', 'ktest', 'nt4_dc', 'nt4_dc_smb1_done', 'nt4_dc_smb1', 'simpleserver', 'fileserver_smb1_done', 'fileserver', 'maptoguest', 'nt4_dc_schannel']: + planoldpythontestsuite(env, "samba.tests.imports") + planoldpythontestsuite("none", "samba.tests.krb5.kcrypto") planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.simple_tests", environ={'SERVICE_USERNAME':'$SERVER'})