Add WS API for removing statistics for a list of statistic_ids (#55078)
* Add WS API for removing statistics for a list of statistic_ids * Refactor according to code review, enable foreign keys support for sqlite * Adjust tests * Move clear_statistics WS API to recorder * Adjust tests after rebase * Update docstring * Update homeassistant/components/recorder/websocket_api.py Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> * Adjust tests after rebase Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
0653693dff
commit
5976f898da
6 changed files with 188 additions and 2 deletions
|
@ -149,15 +149,17 @@ def test_setup_connection_for_dialect_sqlite():
|
|||
|
||||
util.setup_connection_for_dialect("sqlite", dbapi_connection, True)
|
||||
|
||||
assert len(execute_mock.call_args_list) == 2
|
||||
assert len(execute_mock.call_args_list) == 3
|
||||
assert execute_mock.call_args_list[0][0][0] == "PRAGMA journal_mode=WAL"
|
||||
assert execute_mock.call_args_list[1][0][0] == "PRAGMA cache_size = -8192"
|
||||
assert execute_mock.call_args_list[2][0][0] == "PRAGMA foreign_keys=ON"
|
||||
|
||||
execute_mock.reset_mock()
|
||||
util.setup_connection_for_dialect("sqlite", dbapi_connection, False)
|
||||
|
||||
assert len(execute_mock.call_args_list) == 1
|
||||
assert len(execute_mock.call_args_list) == 2
|
||||
assert execute_mock.call_args_list[0][0][0] == "PRAGMA cache_size = -8192"
|
||||
assert execute_mock.call_args_list[1][0][0] == "PRAGMA foreign_keys=ON"
|
||||
|
||||
|
||||
def test_basic_sanity_check(hass_recorder):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue