From 771cb01577bc21364de05974c44fec416a387d8c Mon Sep 17 00:00:00 2001 From: Anja Istenic Date: Mon, 25 Jul 2022 11:07:11 +0200 Subject: [PATCH] test(hooks/exasol): add test for no resultSet rtn type --- tests/providers/exasol/hooks/test_exasol.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/providers/exasol/hooks/test_exasol.py b/tests/providers/exasol/hooks/test_exasol.py index bf85465629c43..3440693e60111 100644 --- a/tests/providers/exasol/hooks/test_exasol.py +++ b/tests/providers/exasol/hooks/test_exasol.py @@ -137,6 +137,15 @@ def test_run_no_queries(self): self.db_hook.run(sql=[]) assert err.value.args[0] == "List of SQL statements is empty" + def test_no_result_set(self): + """Queries like DROP and SELECT are of type rowCount (not resultSet), + which raises an error in pyexasol if trying to iterate over them""" + self.cur.result_type = mock.Mock() + self.cur.result_type.return_value = 'rowCount' + + sql = 'SQL' + self.db_hook.run(sql) + def test_bulk_load(self): with pytest.raises(NotImplementedError): self.db_hook.bulk_load('table', '/tmp/file')