mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-01 06:54:22 +02:00
Validate column names in more places, refs #86
This commit is contained in:
parent
67dd3106d5
commit
04ec53c039
3 changed files with 26 additions and 7 deletions
|
|
@ -77,7 +77,7 @@ def test_create_table_with_bad_defaults(fresh_db):
|
|||
)
|
||||
|
||||
|
||||
def test_create_table_with_invalid_column_charactters(fresh_db):
|
||||
def test_create_table_with_invalid_column_characters(fresh_db):
|
||||
with pytest.raises(AssertionError):
|
||||
fresh_db.create_table("players", {"name[foo]": str})
|
||||
|
||||
|
|
@ -449,6 +449,13 @@ def test_insert_row_alter_table(
|
|||
]
|
||||
|
||||
|
||||
def test_insert_row_alter_table_invalid_column_characters(fresh_db):
|
||||
table = fresh_db["table"]
|
||||
rowid = table.insert({"foo": "bar"}).last_pk
|
||||
with pytest.raises(AssertionError):
|
||||
table.insert({"foo": "baz", "new_col[abc]": 1.2}, alter=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_table_factory", [True, False])
|
||||
def test_insert_replace_rows_alter_table(fresh_db, use_table_factory):
|
||||
first_row = {"id": 1, "title": "Hedgehogs of the world", "author_id": 1}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue