From 092cdf56dd25105815dea6521cc3d42efe3d577b Mon Sep 17 00:00:00 2001 From: Emmanuel Keller Date: Fri, 7 Feb 2025 09:35:22 +0000 Subject: [PATCH 1/2] Fix error message --- tests/unit_tests/connections/insert/test_async_http.py | 2 +- tests/unit_tests/connections/insert/test_async_ws.py | 2 +- tests/unit_tests/connections/insert/test_blocking_http.py | 2 +- tests/unit_tests/connections/insert/test_blocking_ws.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit_tests/connections/insert/test_async_http.py b/tests/unit_tests/connections/insert/test_async_http.py index 030df438..014ec4b3 100644 --- a/tests/unit_tests/connections/insert/test_async_http.py +++ b/tests/unit_tests/connections/insert/test_async_http.py @@ -53,7 +53,7 @@ async def test_insert_record_id_result_error(self): with self.assertRaises(Exception) as context: _ = await self.connection.insert(record_id, self.insert_data) 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: user:tobie" in str(context.exception), True ) await self.connection.query("DELETE user;") diff --git a/tests/unit_tests/connections/insert/test_async_ws.py b/tests/unit_tests/connections/insert/test_async_ws.py index 0f9e69b2..4c230d6a 100644 --- a/tests/unit_tests/connections/insert/test_async_ws.py +++ b/tests/unit_tests/connections/insert/test_async_ws.py @@ -54,7 +54,7 @@ async def test_insert_record_id_result_error(self): with self.assertRaises(Exception) as context: _ = await self.connection.insert(record_id, self.insert_data) 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: user:tobie" in str(context.exception), True ) await self.connection.query("DELETE user;") diff --git a/tests/unit_tests/connections/insert/test_blocking_http.py b/tests/unit_tests/connections/insert/test_blocking_http.py index 23e58d47..a848f029 100644 --- a/tests/unit_tests/connections/insert/test_blocking_http.py +++ b/tests/unit_tests/connections/insert/test_blocking_http.py @@ -58,7 +58,7 @@ 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) + "There was a problem with the database: Can not execute INSERT statement using value: user:tobie" in str(context.exception) ) self.connection.query("DELETE user;") diff --git a/tests/unit_tests/connections/insert/test_blocking_ws.py b/tests/unit_tests/connections/insert/test_blocking_ws.py index 02066946..acc42ae8 100644 --- a/tests/unit_tests/connections/insert/test_blocking_ws.py +++ b/tests/unit_tests/connections/insert/test_blocking_ws.py @@ -57,7 +57,7 @@ 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'" + "There was a problem with the database: Can not execute INSERT statement using value: user:tobie" in str(context.exception) ) From 666f1c80639686d4b9c933dff3497f458ccdd178 Mon Sep 17 00:00:00 2001 From: Emmanuel Keller Date: Fri, 7 Feb 2025 09:48:11 +0000 Subject: [PATCH 2/2] Fix tests --- tests/unit_tests/connections/insert/test_async_http.py | 3 ++- tests/unit_tests/connections/insert/test_async_ws.py | 3 ++- tests/unit_tests/connections/insert/test_blocking_http.py | 6 ++++-- tests/unit_tests/connections/insert/test_blocking_ws.py | 7 ++++--- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/unit_tests/connections/insert/test_async_http.py b/tests/unit_tests/connections/insert/test_async_http.py index 014ec4b3..dd406167 100644 --- a/tests/unit_tests/connections/insert/test_async_http.py +++ b/tests/unit_tests/connections/insert/test_async_http.py @@ -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;") diff --git a/tests/unit_tests/connections/insert/test_async_ws.py b/tests/unit_tests/connections/insert/test_async_ws.py index 4c230d6a..88f51dc8 100644 --- a/tests/unit_tests/connections/insert/test_async_ws.py +++ b/tests/unit_tests/connections/insert/test_async_ws.py @@ -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;") diff --git a/tests/unit_tests/connections/insert/test_blocking_http.py b/tests/unit_tests/connections/insert/test_blocking_http.py index a848f029..997bc96c 100644 --- a/tests/unit_tests/connections/insert/test_blocking_http.py +++ b/tests/unit_tests/connections/insert/test_blocking_http.py @@ -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;") diff --git a/tests/unit_tests/connections/insert/test_blocking_ws.py b/tests/unit_tests/connections/insert/test_blocking_ws.py index acc42ae8..8fc8367d 100644 --- a/tests/unit_tests/connections/insert/test_blocking_ws.py +++ b/tests/unit_tests/connections/insert/test_blocking_ws.py @@ -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 )