diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-27 18:53:19 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-03-27 19:01:34 +0100 |
commit | b4e8115ec719e8852ccef852b7a8a06ec34b81db (patch) | |
tree | 068049670f14d5f7877af7ce701132b31194beee | |
parent | 7de2f2fcf233c1e935c5bc9d8c97bcaf075d0f8b (diff) | |
download | paste-b4e8115ec719e8852ccef852b7a8a06ec34b81db.tar.gz paste-b4e8115ec719e8852ccef852b7a8a06ec34b81db.tar.xz paste-b4e8115ec719e8852ccef852b7a8a06ec34b81db.zip |
paste.db: readd missing import of sha256
-rw-r--r-- | paste/db.py | 2 | ||||
-rw-r--r-- | tests/test_db.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/paste/db.py b/paste/db.py index 3dff8d6..c4ee46e 100644 --- a/paste/db.py +++ b/paste/db.py @@ -1,7 +1,7 @@ import sqlite3 from collections.abc import Iterator from contextlib import contextmanager -from hashlib import blake2b +from hashlib import blake2b, sha256 from itertools import count from typing import Optional, Union diff --git a/tests/test_db.py b/tests/test_db.py index d1b269a..5c973ab 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -51,3 +51,9 @@ def test_hash_behaves_normally(unmigrated_conn, a, b, expected): "SELECT DATA_HASH(?) == DATA_HASH(?)", (a, b) ).fetchone() assert res == (1 if expected else 0) + + +@pytest.mark.parametrize("a,b,expected", hash_testdata) +def test_sha256_behaves_normally(unmigrated_conn, a, b, expected): + (res,) = unmigrated_conn.execute("SELECT SHA256(?) == SHA256(?)", (a, b)).fetchone() + assert res == (1 if expected else 0) |