diff mbox series

[8/8] toaster/tests: Improve a test to give better debug output

Message ID 20241008123627.252307-8-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 6292b5a81ce1f3cf35980d0f669a1b52f3c56695
Headers show
Series [1/8] COW: Fix hardcoded magic numbers and work with python 3.13 | expand

Commit Message

Richard Purdie Oct. 8, 2024, 12:36 p.m. UTC
"False is not True" is not a helpful error messgae. "XXX not in YYY" is
much more helpful. Tweak the test to give more meaninful failure messages
using assertIn rather than assertTrue.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/toaster/tests/functional/test_project_page.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/toaster/tests/functional/test_project_page.py b/lib/toaster/tests/functional/test_project_page.py
index 0e36b44ffd..deb26812ea 100644
--- a/lib/toaster/tests/functional/test_project_page.py
+++ b/lib/toaster/tests/functional/test_project_page.py
@@ -719,16 +719,16 @@  class TestProjectPage(SeleniumFunctionalTestCase):
         remove_layer_btn.click()
         self.wait_until_visible('#change-notification', poll=2)
         change_notification = self.find('#change-notification')
-        self.assertTrue(
-            f'You have removed 1 layer from your project' in str(change_notification.text)
+        self.assertIn(
+            f'You have removed 1 layer from your project', str(change_notification.text)
         )
         # check add layer button works, 18 is the random layer id
         add_layer_btn = self.find('#add-remove-layer-btn')
         add_layer_btn.click()
         self.wait_until_visible('#change-notification')
         change_notification = self.find('#change-notification')
-        self.assertTrue(
-            f'You have added 1 layer to your project' in str(change_notification.text)
+        self.assertIn(
+            f'You have added 1 layer to your project', str(change_notification.text)
         )
         # check tabs(layers, recipes, machines) are displayed
         tabs = self.find_all('.nav-tabs li')