Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #19 from myoung34/hotfix/sqlite_commit
Browse files Browse the repository at this point in the history
Hotfix: sqlite connection should commit
  • Loading branch information
myoung34 authored Jul 31, 2020
2 parents 0905269 + 053707a commit 46b2854
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]
1 change: 1 addition & 0 deletions tilty/emitters/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 46b2854

Please sign in to comment.