From 053707a47ddea2e2d260d19a591a9c4f8a6fc3c3 Mon Sep 17 00:00:00 2001 From: Marcus Young Date: Fri, 31 Jul 2020 16:27:59 -0500 Subject: [PATCH] Hotfix: sqlite connection should commit --- tests/test_sqlite.py | 3 ++- tilty/emitters/sqlite.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py index f054f1d..995822f 100644 --- a/tests/test_sqlite.py +++ b/tests/test_sqlite.py @@ -19,5 +19,6 @@ def test_sqlite( assert mock_sqlite_client.mock_calls == [ mock.call.connect('/etc/tilty/tilt.sqlite'), mock.call.connect().execute('\n CREATE TABLE IF NOT EXISTS data(\n id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n gravity INTEGER,\n temp INTEGER,\n color VARCHAR(16),\n mac VARCHAR(17),\n timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL)\n '), # noqa - mock.call.connect().execute('insert into data (gravity,temp,color,mac) values (?,?,?,?)', (1000, 80, 'black', '00:0a:95:9d:68:16')) # noqa + mock.call.connect().execute('insert into data (gravity,temp,color,mac) values (?,?,?,?)', (1000, 80, 'black', '00:0a:95:9d:68:16')), # noqa + mock.call.connect().commit(), ] diff --git a/tilty/emitters/sqlite.py b/tilty/emitters/sqlite.py index 58f7915..ecd1cd7 100644 --- a/tilty/emitters/sqlite.py +++ b/tilty/emitters/sqlite.py @@ -40,3 +40,4 @@ def emit(self, **kwargs): # pylint: disable=no-self-use,unused-argument "insert into data (gravity,temp,color,mac) values (?,?,?,?)", (self.gravity, self.temp, self.color, self.mac) ) + self.conn.commit()