mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-06 09:24:11 +02:00
Ability to insert base64 binary data as JSON, closes #126
This commit is contained in:
parent
814d4a7f90
commit
1a61a6d3d6
5 changed files with 67 additions and 3 deletions
|
|
@ -554,6 +554,18 @@ def test_insert_not_null_default(db_path, tmpdir):
|
|||
) == db["dogs"].schema
|
||||
|
||||
|
||||
def test_insert_binary_base64(db_path):
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "files", "-"],
|
||||
input=r'{"content": {"$base64": true, "encoded": "aGVsbG8="}}',
|
||||
)
|
||||
assert 0 == result.exit_code, result.output
|
||||
db = Database(db_path)
|
||||
actual = db.execute_returning_dicts("select content from files")
|
||||
assert actual == [{"content": b"hello"}]
|
||||
|
||||
|
||||
def test_insert_newline_delimited(db_path):
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue