1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-21 20:23:50 +03:00

python:tests: Make sure we delete the OU for movetest

UNEXPECTED(failure): samba.tests.samba_tool.group.samba.tests.samba_tool.group.GroupCmdTestCase.test_move(ad_dc_default:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "python/samba/tests/samba_tool/group.py", line 341, in test_move
    self.assertCmdSuccess(result, out, err)
  File "python/samba/tests/samba_tool/base.py", line 97, in assertCmdSuccess
    self.assertIsNone(exit, msg=msg.replace("\n]\n", "\n] \n"))
AssertionError: -1 is not None : exit[-1] stdout[] stderr[ERROR(ldb): Failed to
  add ou "OU=movetest,DC=addom,DC=samba,DC=example,DC=com" - Entry
  OU=movetest,DC=addom,DC=samba,DC=example,DC=com already exists

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider
2023-02-08 15:44:43 +01:00
committed by Andrew Bartlett
parent 69442ae107
commit a4307072d6
2 changed files with 6 additions and 10 deletions

View File

@@ -336,7 +336,9 @@ class GroupCmdTestCase(SambaToolCmdTest):
def test_move(self): def test_move(self):
full_ou_dn = str(self.samdb.normalize_dn_in_domain("OU=movetest")) full_ou_dn = str(self.samdb.normalize_dn_in_domain("OU=movetest_grp"))
self.addCleanup(self.samdb.delete, full_ou_dn, ["tree_delete:1"])
(result, out, err) = self.runsubcmd("ou", "add", full_ou_dn) (result, out, err) = self.runsubcmd("ou", "add", full_ou_dn)
self.assertCmdSuccess(result, out, err) self.assertCmdSuccess(result, out, err)
self.assertEqual(err, "", "There shouldn't be any error message") self.assertEqual(err, "", "There shouldn't be any error message")
@@ -363,10 +365,6 @@ class GroupCmdTestCase(SambaToolCmdTest):
self.assertIn('Moved group "%s" into "%s"' % self.assertIn('Moved group "%s" into "%s"' %
(group["name"], new_dn), out) (group["name"], new_dn), out)
(result, out, err) = self.runsubcmd("ou", "delete", full_ou_dn)
self.assertCmdSuccess(result, out, err,
"Failed to delete ou '%s'" % full_ou_dn)
def test_show(self): def test_show(self):
"""Assert that we can show a group correctly.""" """Assert that we can show a group correctly."""
(result, out, err) = self.runsubcmd("group", "show", "Domain Users", (result, out, err) = self.runsubcmd("group", "show", "Domain Users",

View File

@@ -708,7 +708,9 @@ sAMAccountName: %s
self.assertGreater(pwd_expires_time, pwd_last_set_time) self.assertGreater(pwd_expires_time, pwd_last_set_time)
def test_move(self): def test_move(self):
full_ou_dn = str(self.samdb.normalize_dn_in_domain("OU=movetest")) full_ou_dn = str(self.samdb.normalize_dn_in_domain("OU=movetest_usr"))
self.addCleanup(self.samdb.delete, full_ou_dn, ["tree_delete:1"])
(result, out, err) = self.runsubcmd("ou", "add", full_ou_dn) (result, out, err) = self.runsubcmd("ou", "add", full_ou_dn)
self.assertCmdSuccess(result, out, err) self.assertCmdSuccess(result, out, err)
self.assertEqual(err, "", "There shouldn't be any error message") self.assertEqual(err, "", "There shouldn't be any error message")
@@ -735,10 +737,6 @@ sAMAccountName: %s
self.assertIn('Moved user "%s" into "%s"' % self.assertIn('Moved user "%s" into "%s"' %
(user["name"], new_dn), out) (user["name"], new_dn), out)
(result, out, err) = self.runsubcmd("ou", "delete", full_ou_dn)
self.assertCmdSuccess(result, out, err,
"Failed to delete ou '%s'" % full_ou_dn)
def test_rename_surname_initials_givenname(self): def test_rename_surname_initials_givenname(self):
"""rename the existing surname and given name and add missing """rename the existing surname and given name and add missing
initials, then remove them, for all users""" initials, then remove them, for all users"""