Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes error message assertion in tests #158

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/unit_tests/connections/insert/test_async_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ async def test_insert_record_id_result_error(self):

with self.assertRaises(Exception) as context:
_ = await self.connection.insert(record_id, self.insert_data)
e = str(context.exception)
self.assertEqual(
"There was a problem with the database: Can not execute INSERT statement using value 'user:tobie'" in str(context.exception),
"There was a problem with the database: Can not execute INSERT statement using value" in e and "user:tobie" in e,
True
)
await self.connection.query("DELETE user;")
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/connections/insert/test_async_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ async def test_insert_record_id_result_error(self):

with self.assertRaises(Exception) as context:
_ = await self.connection.insert(record_id, self.insert_data)
e = str(context.exception)
self.assertEqual(
"There was a problem with the database: Can not execute INSERT statement using value 'user:tobie'" in str(context.exception),
"There was a problem with the database: Can not execute INSERT statement using value" in e and "user:tobie" in e,
True
)
await self.connection.query("DELETE user;")
Expand Down
6 changes: 4 additions & 2 deletions tests/unit_tests/connections/insert/test_blocking_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def test_insert_record_id_result_error(self):

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

Expand Down
7 changes: 4 additions & 3 deletions tests/unit_tests/connections/insert/test_blocking_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ def test_insert_record_id_result_error(self):

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


Expand Down