diff --git a/matemat/db/facade.py b/matemat/db/facade.py index 4966c9b..09fc4ce 100644 --- a/matemat/db/facade.py +++ b/matemat/db/facade.py @@ -285,9 +285,9 @@ class MatematDatabase(object): }) # TODO: Implement reason field c.execute(''' - INSERT INTO modifications (ta_id, agent_id, reason) - VALUES (last_insert_rowid(), :agent_id, NULL) - ''', {'agent_id': agent.id}) + INSERT INTO modifications (ta_id, agent, reason) + VALUES (last_insert_rowid(), :agent, NULL) + ''', {'agent': agent.name}) c.execute(''' UPDATE users SET username = :username, diff --git a/matemat/db/test/test_wrapper.py b/matemat/db/test/test_wrapper.py index 0b78890..1a72388 100644 --- a/matemat/db/test/test_wrapper.py +++ b/matemat/db/test/test_wrapper.py @@ -53,12 +53,12 @@ class DatabaseTest(unittest.TestCase): with self.db as db: with db.transaction() as c: c.execute(''' - INSERT INTO users VALUES (1, 'testuser', NULL, 'supersecurepassword', NULL, 1, 1, 0, 42) + INSERT INTO users VALUES (1, 'testuser', NULL, 'supersecurepassword', NULL, 1, 1, 0, 42, 0) ''') c = db._sqlite_db.cursor() c.execute("SELECT * FROM users") user = c.fetchone() - self.assertEqual((1, 'testuser', None, 'supersecurepassword', None, 1, 1, 0, 42), user) + self.assertEqual((1, 'testuser', None, 'supersecurepassword', None, 1, 1, 0, 42, 0), user) def test_transaction_rollback(self) -> None: """ @@ -67,9 +67,9 @@ class DatabaseTest(unittest.TestCase): with self.db as db: try: with db.transaction() as c: - c.execute(""" - INSERT INTO users VALUES (1, 'testuser', NULL, 'supersecurepassword', NULL, 1, 1, 0, 42) - """) + c.execute(''' + INSERT INTO users VALUES (1, 'testuser', NULL, 'supersecurepassword', NULL, 1, 1, 0, 42, 0) + ''') raise ValueError('This should trigger a rollback') except ValueError as e: if str(e) != 'This should trigger a rollback':