Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mfshao committed Oct 28, 2022
1 parent dc2fa7d commit 2da8ffd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": null,
"lines": null
},
"generated_at": "2022-10-28T14:44:01Z",
"generated_at": "2022-10-28T16:39:53Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -116,7 +116,7 @@
{
"hashed_secret": "ecdb6b62dc6de954dbbef8185029415aecae5e5a",
"is_verified": false,
"line_number": 284,
"line_number": 291,
"type": "Hex High Entropy String"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def escape(str):
# escape colon for sa.text() and single quotes for SQL statement
return str.replace(":", "\:").replace("'", "''")
return str.replace(":", "\\:").replace("'", "''")


def upgrade():
Expand Down
13 changes: 10 additions & 3 deletions tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def escape(str):
# escape single quotes for SQL statement
return str.replace("'", "''")
return str.replace(":", "\\:").replace("'", "''")


@pytest.mark.asyncio
Expand Down Expand Up @@ -250,16 +250,23 @@ async def test_6819874e85b9_upgrade():
alembic_main(["--raiseerr", "downgrade", "3354f2c466ec"])

fake_guid = "7891011"
# "percent" and "colon" are some edge cases that was causing the migration to fail
old_metadata = {
"foo": "bar",
"bizz": "buzz",
"special": "50% for",
"percent": "50% for",
"colon": "14(10):1534-47",
"_uploader_id": "uploader",
"_filename": "hello.txt",
"_bucket": "mybucket",
"_file_extension": ".txt",
}
new_metadata = {"foo": "bar", "bizz": "buzz", "special": "50% for"}
new_metadata = {
"foo": "bar",
"bizz": "buzz",
"percent": "50% for",
"colon": "14(10):1534-47",
}
authz_data = {"version": 0, "_resource_paths": ["/programs/DEV"]}

async with db.with_bind(DB_DSN):
Expand Down

0 comments on commit 2da8ffd

Please sign in to comment.