1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-24 04:23:53 +03:00

netcmd: tests: stop checking for ERROR prefix from CommandError

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-10-19 14:26:46 +13:00
committed by Andrew Bartlett
parent fb058e7f2c
commit 6943a58bff
3 changed files with 21 additions and 22 deletions

View File

@@ -312,7 +312,7 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest):
result, out, err = self.runcmd("domain", "auth", "policy", "create",
"--name", "createFails")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
def test_authentication_policy_modify_description(self):
"""Test modifying an authentication policy description."""
@@ -480,8 +480,7 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest):
"--name", "doesNotExist",
"--description", "NewDescription")
self.assertEqual(result, -1)
self.assertIn("ERROR: Authentication policy doesNotExist not found.",
err)
self.assertIn("Authentication policy doesNotExist not found.", err)
def test_authentication_policy_modify_audit_enforce(self):
"""Test modify authentication policy using --audit and --enforce."""
@@ -564,7 +563,7 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest):
"--name", "Single Policy",
"--description", "New description")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
def test_authentication_policy_delete(self):
"""Test deleting an authentication policy that is not protected."""
@@ -643,7 +642,7 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest):
"--name", "deleteForceFail",
"--force")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
def test_authentication_policy_delete_fails(self):
"""Test deleting an authentication policy, but it fails."""
@@ -660,7 +659,7 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest):
result, out, err = self.runcmd("domain", "auth", "policy", "delete",
"--name", "regularPolicy")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
# When not using --force we get a hint.
self.assertIn("Try --force", err)
@@ -682,7 +681,7 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest):
"--name", "protectedPolicy",
"--force")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
# When using --force we don't get the hint.
self.assertNotIn("Try --force", err)

View File

@@ -81,7 +81,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
result, out, err = self.runcmd("domain", "auth", "silo", "view",
"--name", "doesNotExist")
self.assertEqual(result, -1)
self.assertIn("ERROR: Authentication silo doesNotExist not found.", err)
self.assertIn("Authentication silo doesNotExist not found.", err)
def test_authentication_silo_view_name_required(self):
"""Test view authentication silo without --name argument."""
@@ -227,7 +227,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
"--name", "createFails",
"--policy", "Single Policy")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
def test_authentication_silo_modify_description(self):
"""Test modify authentication silo changing the description field."""
@@ -323,7 +323,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
"--name", "doesNotExist",
"--description=NewDescription")
self.assertEqual(result, -1)
self.assertIn("ERROR: Authentication silo doesNotExist not found.", err)
self.assertIn("Authentication silo doesNotExist not found.", err)
def test_authentication_silo_modify_name_missing(self):
"""Test modify authentication silo without --name argument."""
@@ -340,7 +340,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
"--name", "developers",
"--description", "Devs")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
def test_authentication_silo_delete(self):
"""Test deleting an authentication silo that is not protected."""
@@ -422,7 +422,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
"--name", "deleteForceFail",
"--force")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
def test_authentication_silo_delete_fails(self):
"""Test deleting an authentication silo, but it fails."""
@@ -440,7 +440,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
result, out, err = self.runcmd("domain", "auth", "silo", "delete",
"--name", "regularSilo")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
# When not using --force we get a hint.
self.assertIn("Try --force", err)
@@ -463,7 +463,7 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest):
"--name", "protectedSilo",
"--force")
self.assertEqual(result, -1)
self.assertIn("ERROR: Custom error message", err)
self.assertIn("Custom error message", err)
# When using --force we don't get the hint.
self.assertNotIn("Try --force", err)

View File

@@ -180,14 +180,14 @@ class ClaimCmdTestCase(SambaToolCmdTest):
"""Test view claim type without --name is handled."""
result, out, err = self.runcmd("domain", "claim", "claim-type", "view")
self.assertEqual(result, -1)
self.assertIn("ERROR: Argument --name is required.", err)
self.assertIn("Argument --name is required.", err)
def test_claim_type_view_notfound(self):
"""Test viewing claim type that doesn't exist is handled."""
result, out, err = self.runcmd("domain", "claim", "claim-type",
"view", "--name", "doesNotExist")
self.assertEqual(result, -1)
self.assertIn("ERROR: Claim type doesNotExist not found.", err)
self.assertIn("Claim type doesNotExist not found.", err)
def test_claim_type_create(self):
"""Test creating several known attributes as claim types.
@@ -350,7 +350,7 @@ class ClaimCmdTestCase(SambaToolCmdTest):
"create", "--attribute=wWWHomePage",
"--name=homepage")
self.assertEqual(result, -1)
self.assertIn("ERROR: Argument --class is required.", err)
self.assertIn("Argument --class is required.", err)
def test_claim_type_delete(self):
"""Test deleting a claim type that is not protected."""
@@ -405,7 +405,7 @@ class ClaimCmdTestCase(SambaToolCmdTest):
result, out, err = self.runcmd("domain", "claim", "claim-type",
"delete", "--name", "doesNotExist")
self.assertEqual(result, -1)
self.assertIn("ERROR: Claim type doesNotExist not found.", err)
self.assertIn("Claim type doesNotExist not found.", err)
def test_claim_type_modify_description(self):
"""Test modifying a claim type description."""
@@ -435,7 +435,7 @@ class ClaimCmdTestCase(SambaToolCmdTest):
"modify", "--name", "seeAlso",
"--class=")
self.assertEqual(result, -1)
self.assertIn("ERROR: Class name is required.", err)
self.assertIn("Class name is required.", err)
# Try changing it to just --class=computer first.
result, out, err = self.runcmd("domain", "claim", "claim-type",
@@ -546,7 +546,7 @@ class ClaimCmdTestCase(SambaToolCmdTest):
"modify", "--name", "doesNotExist",
"--description=NewDescription")
self.assertEqual(result, -1)
self.assertIn("ERROR: Claim type doesNotExist not found.", err)
self.assertIn("Claim type doesNotExist not found.", err)
def test_value_type_list(self):
"""Test listing claim value types in list format."""
@@ -589,11 +589,11 @@ class ClaimCmdTestCase(SambaToolCmdTest):
"""Test viewing a claim value type with missing --name is handled."""
result, out, err = self.runcmd("domain", "claim", "value-type", "view")
self.assertEqual(result, -1)
self.assertIn("ERROR: Argument --name is required.", err)
self.assertIn("Argument --name is required.", err)
def test_value_type_view_notfound(self):
"""Test viewing a claim value type that doesn't exist is handled."""
result, out, err = self.runcmd("domain", "claim", "value-type",
"view", "--name", "doesNotExist")
self.assertEqual(result, -1)
self.assertIn("ERROR: Value type doesNotExist not found.", err)
self.assertIn("Value type doesNotExist not found.", err)