Files
MyAiConfiguration/scripts/benchmarks/tasks/04-security-sql/hidden/test_hidden.py
T
Julian lechnerandClaude Opus 5.5 3480072ed7 test(benchmarks): add A/B task fixtures with hidden checks
Ten small Python tasks, each failing on the fixture and passing with a
reference solution, including workflow expectations for a small change, a
bugfix, and a delegable change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 12:45:40 +02:00

17 lines
537 B
Python

import sqlite3
import unittest
from app.users import find_user
class Hidden(unittest.TestCase):
def setUp(self):
self.conn = sqlite3.connect(':memory:')
self.conn.execute('CREATE TABLE users (id INTEGER, name TEXT)')
self.conn.executemany('INSERT INTO users VALUES (?, ?)', [(1, "O'Brien"), (2, 'admin')])
def test_apostrophe(self):
self.assertEqual(find_user(self.conn, "O'Brien"), (1, "O'Brien"))
def test_injection(self):
self.assertIsNone(find_user(self.conn, "x' OR '1'='1"))