From 4e4a3b75515b2ecf3b071f606987acaa162d8308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hellebrandt?= Date: Wed, 6 Sep 2023 19:37:27 +0200 Subject: [PATCH] Expect exception instead of false return value (#12508) (cherry picked from commit af79e0c615a50e3202e43c483f2edabb2e6293ee) --- tests/foreman/ui/test_organization.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/foreman/ui/test_organization.py b/tests/foreman/ui/test_organization.py index 278c26cda1..bd57330b3b 100644 --- a/tests/foreman/ui/test_organization.py +++ b/tests/foreman/ui/test_organization.py @@ -116,7 +116,12 @@ def test_positive_end_to_end(session): ) assert session.organization.search(new_name) org_values = session.organization.read(new_name, widget_names=widget_list) - assert not session.organization.delete(new_name) + with pytest.raises(AssertionError) as context: + assert not session.organization.delete(new_name) + assert ( + 'The current organization cannot be deleted. Please switch to a ' + 'different organization before deleting.' in str(context.value) + ) assert user.login in org_values['users']['resources']['assigned'] assert media.name in org_values['media']['resources']['assigned'] assert template.name in org_values['provisioning_templates']['resources']['assigned']