Skip to content

Commit

Permalink
Removed sample database file, adjusted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrecsilva committed Oct 25, 2023
1 parent 22a8649 commit ce44d62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions integration_tests/test_sql_parameterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ class TestSQLQueryParameterization(BaseIntegrationTest):
original_code, expected_new_code = original_and_expected_from_code_path(
code_path,
[
(7, """ b = " WHERE name =?"\n"""),
(8, """ c = " AND phone = ?"\n"""),
(9, """ r = cursor.execute(a + b + c, (name, phone, ))\n"""),
(9, """ b = " WHERE name =?"\n"""),
(10, """ c = " AND phone = ?"\n"""),
(11, """ r = cursor.execute(a + b + c, (name, phone, ))\n"""),
],
)

# fmt: off
expected_diff =(
"""--- \n"""
"""+++ \n"""
"""@@ -5,9 +5,9 @@\n"""
"""@@ -7,9 +7,9 @@\n"""
""" \n"""
""" def foo(cursor: sqlite3.Cursor, name: str, phone: str):\n"""
""" a = "SELECT * FROM Users"\n"""
Expand All @@ -36,6 +36,6 @@ class TestSQLQueryParameterization(BaseIntegrationTest):
""" \n""")
# fmt: on

expected_line_change = "10"
expected_line_change = "12"
change_description = SQLQueryParameterization.CHANGE_DESCRIPTION
num_changed_files = 1
Binary file removed tests/samples/my_db.db
Binary file not shown.
4 changes: 3 additions & 1 deletion tests/samples/sql_injection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sqlite3

connection = sqlite3.connect("tests/samples/my_db.db")
connection = sqlite3.connect(":memory:")
connection.cursor().execute("CREATE TABLE Users (name, phone)")
connection.cursor().execute("INSERT INTO Users VALUES ('Jenny','867-5309')")


def foo(cursor: sqlite3.Cursor, name: str, phone: str):
Expand Down

0 comments on commit ce44d62

Please sign in to comment.