1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-18 08:23:51 +03:00

netcmd: tests: test that create objects make use of addCleanup

Since the samdb connection is on the class and hangs around between tests, we need to clean up what we created.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Rob van der Linde
2023-09-28 14:48:09 +13:00
committed by Andrew Bartlett
parent 91fa5088b5
commit f1d5f93f3d
3 changed files with 46 additions and 0 deletions

View File

@@ -91,6 +91,9 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
def test_authentication_silo_create_single_policy(self):
"""Test creating a new authentication silo with a single policy."""
self.addCleanup(self.delete_authentication_silo,
name="singlePolicy", force=True)
result, out, err = self.runcmd("domain", "auth", "silo", "create",
"--name", "singlePolicy",
"--policy", "Single Policy")
@@ -106,6 +109,9 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
def test_authentication_silo_create_multiple_policies(self):
"""Test creating a new authentication silo with multiple policies."""
self.addCleanup(self.delete_authentication_silo,
name="multiplePolicies", force=True)
result, out, err = self.runcmd("domain", "auth", "silo", "create",
"--name", "multiplePolicies",
"--user-policy", "User Policy",
@@ -125,6 +131,9 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
"""Test creating a new authentication silo when policy is a dn."""
policy = self.get_authentication_policy("Single Policy")
self.addCleanup(self.delete_authentication_silo,
name="singlePolicyDN", force=True)
result, out, err = self.runcmd("domain", "auth", "silo", "create",
"--name", "singlePolicyDN",
"--policy", policy["dn"])
@@ -155,6 +164,9 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
def test_authentication_silo_create_audit(self):
"""Test create authentication silo with --audit flag."""
self.addCleanup(self.delete_authentication_silo,
name="auditPolicies", force=True)
result, out, err = self.runcmd("domain", "auth", "silo", "create",
"--name", "auditPolicies",
"--policy", "Single Policy",
@@ -167,6 +179,9 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
def test_authentication_silo_create_enforce(self):
"""Test create authentication silo with --enforce flag."""
self.addCleanup(self.delete_authentication_silo,
name="enforcePolicies", force=True)
result, out, err = self.runcmd("domain", "auth", "silo", "create",
"--name", "enforcePolicies",
"--policy", "Single Policy",