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()