From 9f773ff5ac2b5af84e1fc2250bf636f818df720b Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Mon, 16 Jan 2023 20:20:52 -0300
Subject: [PATCH] pwpolicy: Fix tests for 'minlength: ""'

When clearing minimum length parameter, FreeIPA raises an error, and the
error is different when executing the playbook in server or client
context. Since the error message is evaluated in the text, both errors
must be accepted as "not a failure", since ansible-freeipa did the
correct call.

Once https://pagure.io/freeipa/issue/9297 is fixed, the test must be
updated to not accept any of these error messages.
---
 tests/pwpolicy/test_pwpolicy.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/pwpolicy/test_pwpolicy.yml b/tests/pwpolicy/test_pwpolicy.yml
index fc02914b..9d60a92c 100644
--- a/tests/pwpolicy/test_pwpolicy.yml
+++ b/tests/pwpolicy/test_pwpolicy.yml
@@ -175,7 +175,13 @@
       name: ops
       minlength: ""
     register: result
-    failed_when: result.changed or (result.failed and "int() argument must be a string, a bytes-like object" not in result.msg)
+    failed_when:
+        result.changed or (
+            result.failed and not (
+                "an internal error has occurred" in result.msg
+                or "int() argument must be" in result.msg
+            )
+        )
     when: ipa_version is version("4.9", ">=")
 
   - name: Ensure minlength is not cleared due to FreeIPA issue
-- 
GitLab