From ca55362293521ae14bfc15ae0bd9497476faa8b4 Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Sun, 11 Jun 2023 09:32:57 -0400 Subject: [PATCH] Create test for known UPDATE query bug --- tests/connectors/core/test_records.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/connectors/core/test_records.py b/tests/connectors/core/test_records.py index b4aba57..f73185e 100644 --- a/tests/connectors/core/test_records.py +++ b/tests/connectors/core/test_records.py @@ -1424,6 +1424,33 @@ class CoreRecordsTestMixin: self.assertNotIn(old_row_2, results) self.assertNotIn(old_row_3, results) + with self.subTest('With columns quoted'): + self.connector.records.update( + table_name, + '"name" = {0}Abc 123{0}'.format(self.connector.validate._quote_str_literal_format), + '\'id\' = 4', + ) + self.connector.records.update( + table_name, + '"name" = {0}Testing{0}'.format(self.connector.validate._quote_str_literal_format), + '"id" = 2', + ) + + # Verify all rows updated. + results = self.connector.query.execute('SELECT * FROM {0};'.format(table_name)) + old_row_1 = row_1 + old_row_2 = row_2 + row_1 = (4, 'Abc 123', 'test_desc_1') + row_2 = (2, 'Testing', 'test_desc_2') + row_3 = (3, 'test name', 'testing aaa') + self.assertEqual(len(results), 3) + self.assertIn(row_1, results) + self.assertIn(row_2, results) + self.assertIn(row_3, results) + self.assertNotIn(old_row_1, results) + self.assertNotIn(old_row_2, results) + + def test__update__datetime__success(self): """ Test `UPDATE` query with datetime values. -- GitLab