mirror of
https://github.com/samba-team/samba.git
synced 2025-07-27 07:42:04 +03:00
TestCase.assertEquals() is an alias for TestCase.assertEqual() and has been deprecated since Python 2.7. When we run our tests with in python developer mode (`PYTHONDEVMODE=1 make test`) we get 580 DeprecationWarnings about this. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
53 lines
2.1 KiB
Python
53 lines
2.1 KiB
Python
# Unix SMB/CIFS implementation.
|
|
# Copyright (C) Rowland Penny <rpenny@samba.org> 2016
|
|
#
|
|
# 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 os
|
|
import ldb
|
|
from samba.tests.samba_tool.base import SambaToolCmdTest
|
|
|
|
|
|
class FsmoCmdTestCase(SambaToolCmdTest):
|
|
"""Test for samba-tool fsmo show subcommand"""
|
|
|
|
def test_fsmoget(self):
|
|
"""Run fsmo show to see if it errors"""
|
|
(result, out, err) = self.runsubcmd("fsmo", "show")
|
|
|
|
self.assertCmdSuccess(result, out, err)
|
|
self.assertEqual(err, "", "Shouldn't be any error messages")
|
|
|
|
# Check that the output is sensible
|
|
samdb = self.getSamDB("-H", "ldap://%s" % os.environ["SERVER"],
|
|
"-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
|
|
|
|
try:
|
|
res = samdb.search(base=ldb.Dn(samdb, "CN=Infrastructure,DC=DomainDnsZones") + samdb.get_default_basedn(),
|
|
scope=ldb.SCOPE_BASE, attrs=["fsmoRoleOwner"])
|
|
|
|
self.assertTrue("DomainDnsZonesMasterRole owner: " + str(res[0]["fsmoRoleOwner"][0]) in out)
|
|
except ldb.LdbError as e:
|
|
(enum, string) = e.args
|
|
if enum == ldb.ERR_NO_SUCH_OBJECT:
|
|
self.assertTrue("The 'domaindns' role is not present in this domain" in out)
|
|
else:
|
|
raise
|
|
|
|
res = samdb.search(base=samdb.get_default_basedn(),
|
|
scope=ldb.SCOPE_BASE, attrs=["fsmoRoleOwner"])
|
|
|
|
self.assertTrue("DomainNamingMasterRole owner: " + str(res[0]["fsmoRoleOwner"][0]) in out)
|