summaryrefslogtreecommitdiff
path: root/tests/test_utils
diff options
context:
space:
mode:
authorNicolas Lupien <nicolas@expedibox.com>2023-12-20 11:49:47 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-12-22 08:27:59 +0100
commit2bf46c3825ad4ec170324791d6f3a329316ae2d4 (patch)
tree18ef6877e7fadf81f6554d5aa12142fba53effdf /tests/test_utils
parent5c6906cef4d4858bfe8d00de94eb797aa40b31fd (diff)
Fixed #34658 -- Added SimpleTestCase.assertNotInHTML().
Diffstat (limited to 'tests/test_utils')
-rw-r--r--tests/test_utils/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index bce060f7ef..ce78ffc008 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -1053,6 +1053,16 @@ class InHTMLTests(SimpleTestCase):
with self.assertRaisesMessage(AssertionError, msg):
self.assertInHTML("<b>This</b>", haystack, 3)
+ def test_assert_not_in_html(self):
+ haystack = "<p><b>Hello</b> <span>there</span>! Hi <span>there</span>!</p>"
+ self.assertNotInHTML("<b>Hi</b>", haystack=haystack)
+ msg = (
+ "'<b>Hello</b>' unexpectedly found in the following response"
+ f"\n{haystack!r}"
+ )
+ with self.assertRaisesMessage(AssertionError, msg):
+ self.assertNotInHTML("<b>Hello</b>", haystack=haystack)
+
class JSONEqualTests(SimpleTestCase):
def test_simple_equal(self):