0fcb1e
From c411c2e7b2e400829ffac250db81609ef3c56faa Mon Sep 17 00:00:00 2001
0fcb1e
From: Florence Blanc-Renaud <flo@redhat.com>
0fcb1e
Date: Tue, 29 Nov 2022 10:04:41 +0100
0fcb1e
Subject: [PATCH] webui tests: fix assertion in test_subid.py
0fcb1e
0fcb1e
The test wants to check the error related to an
0fcb1e
exception obtained inside a "with pytest.raises" instruction.
0fcb1e
The object is an ExceptionInfo and offers a match method
0fcb1e
to check the content of the string representation.
0fcb1e
Use this match() method instead of str(excinfo) which now
0fcb1e
returns
0fcb1e
'<ExceptionInfo NoSuchElementException() tblen=10>'
0fcb1e
0fcb1e
Fixes: https://pagure.io/freeipa/issue/9282
0fcb1e
0fcb1e
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
0fcb1e
Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
0fcb1e
---
0fcb1e
 ipatests/test_webui/test_subid.py | 4 ++--
0fcb1e
 1 file changed, 2 insertions(+), 2 deletions(-)
0fcb1e
0fcb1e
diff --git a/ipatests/test_webui/test_subid.py b/ipatests/test_webui/test_subid.py
0fcb1e
index 104b5692da94437880e638c0b2bc8efd41bd969e..3aaf80ac885fea08d0bac7e2f46645fe207f2cb0 100644
0fcb1e
--- a/ipatests/test_webui/test_subid.py
0fcb1e
+++ b/ipatests/test_webui/test_subid.py
0fcb1e
@@ -146,5 +146,5 @@ class test_subid(UI_driver):
0fcb1e
         with pytest.raises(NoSuchElementException) as excinfo:
0fcb1e
             self.delete_record(admin_uid, table_name="ipauniqueid")
0fcb1e
         # Ensure that the exception is really related to missing remove button
0fcb1e
-        msg = "Unable to locate element: .facet-controls button[name=remove]"
0fcb1e
-        assert msg in str(excinfo)
0fcb1e
+        msg = r"Unable to locate element: .facet-controls button\[name=remove\]"
0fcb1e
+        assert excinfo.match(msg)
0fcb1e
-- 
0fcb1e
2.39.1
0fcb1e