def delete_character_inventories(conn, char_id): sql.execute_sql(conn, sql.delete_all('inventories', 'character_id'), char_id)
def delete_all_character_items(conn, char_id): sql.execute_sql(conn, sql.delete_all('items', 'character_id'), char_id)
def test_delete_character_inventories(self): with mock.patch('database.sqlite3') as mocksql: conn = mocksql.connect() database.delete_character_inventories(conn, 1) mocksql.connect().execute.assert_called_with( sql.delete_all('inventories', 'character_id'), (1, ))
def delete_character(conn, char_id): delete_all_character_items(conn, char_id) delete_character_inventories(conn, char_id) sql.execute_sql(conn, sql.delete_all('characters', 'id'), char_id)
def test_sql_delete(self): self.assertEqual(sql.delete_all('items', 'character_id'), """DELETE FROM items WHERE character_id = ?""")