Skip to content

Commit 4aed495

Browse files
Fixes error message assertion in tests (#158)
1 parent 7b5d5fa commit 4aed495

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

tests/unit_tests/connections/insert/test_async_http.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ async def test_insert_record_id_result_error(self):
5252

5353
with self.assertRaises(Exception) as context:
5454
_ = await self.connection.insert(record_id, self.insert_data)
55+
e = str(context.exception)
5556
self.assertEqual(
56-
"There was a problem with the database: Can not execute INSERT statement using value 'user:tobie'" in str(context.exception),
57+
"There was a problem with the database: Can not execute INSERT statement using value" in e and "user:tobie" in e,
5758
True
5859
)
5960
await self.connection.query("DELETE user;")

tests/unit_tests/connections/insert/test_async_ws.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ async def test_insert_record_id_result_error(self):
5353

5454
with self.assertRaises(Exception) as context:
5555
_ = await self.connection.insert(record_id, self.insert_data)
56+
e = str(context.exception)
5657
self.assertEqual(
57-
"There was a problem with the database: Can not execute INSERT statement using value 'user:tobie'" in str(context.exception),
58+
"There was a problem with the database: Can not execute INSERT statement using value" in e and "user:tobie" in e,
5859
True
5960
)
6061
await self.connection.query("DELETE user;")

tests/unit_tests/connections/insert/test_blocking_http.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ def test_insert_record_id_result_error(self):
5757

5858
with self.assertRaises(Exception) as context:
5959
_ = self.connection.insert(record_id, self.insert_data)
60-
self.assertTrue(
61-
"There was a problem with the database: Can not execute INSERT statement using value 'user:tobie'" in str(context.exception)
60+
e = str(context.exception)
61+
self.assertEqual(
62+
"There was a problem with the database: Can not execute INSERT statement using value" in e and "user:tobie" in e,
63+
True
6264
)
6365
self.connection.query("DELETE user;")
6466

tests/unit_tests/connections/insert/test_blocking_ws.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ def test_insert_record_id_result_error(self):
5656

5757
with self.assertRaises(Exception) as context:
5858
_ = self.connection.insert(record_id, self.insert_data)
59-
self.assertTrue(
60-
"There was a problem with the database: Can not execute INSERT statement using value 'user:tobie'"
61-
in str(context.exception)
59+
e = str(context.exception)
60+
self.assertEqual(
61+
"There was a problem with the database: Can not execute INSERT statement using value" in e and "user:tobie" in e,
62+
True
6263
)
6364

6465

0 commit comments

Comments
 (0)