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