From f889cabd323d37e7eb7747edb2d8630d544fc26a Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:02:38 -0400 Subject: [PATCH] [6.14.z] Expect exception instead of false return value (#12516) --- 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']