core/tests/components/sql
dougiteixeira 65c21438a6
Add query type validation independent of declaration position for SQL (#105921)
* Add query type validation independent of declaration position

* Restore close sess

* Separates invalid query and non-read-only query tests

* Add more tests

* Use the SQLParseError exception for queries that are not read-only

* Add handling for multiple SQL queries.

* Fix test

* Clean ';' at the beginning of the SQL query

* Clean ';' at the beginning of the SQL query - init

* Query cleaning before storing

* Query cleaning before setup sesensor plataform - YAML

* Exception when the SQL query type is not detected

* Cleaning

* Cleaning

* Fix typing in tests

* Fix typing in tests

* Add test for query = ';;'

* Update homeassistant/components/sql/__init__.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Update homeassistant/components/sql/__init__.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* Update __init__.py

* Update config_flow.py

* Clean query before storing

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2023-12-27 17:58:35 +01:00
..
__init__.py Add query type validation independent of declaration position for SQL (#105921) 2023-12-27 17:58:35 +01:00
test_config_flow.py Add query type validation independent of declaration position for SQL (#105921) 2023-12-27 17:58:35 +01:00
test_init.py Add query type validation independent of declaration position for SQL (#105921) 2023-12-27 17:58:35 +01:00
test_sensor.py Add query type validation independent of declaration position for SQL (#105921) 2023-12-27 17:58:35 +01:00
test_util.py