Fix for upsert(hash_id=) bug, closes #84

This commit is contained in:
Simon Willison 2020-02-06 23:17:06 -08:00
commit 7c28a4d133
2 changed files with 13 additions and 2 deletions

View file

@ -28,6 +28,14 @@ def test_upsert_error_if_no_pk(fresh_db):
table.upsert({"id": 1, "name": "Cleo"})
def test_upsert_with_hash_id(fresh_db):
table = fresh_db["table"]
table.upsert({"foo": "bar"}, hash_id="pk")
assert [{"pk": "a5e744d0164540d33b1d7ea616c28f2fa97e754a", "foo": "bar"}] == list(
table.rows
)
def test_upsert_compound_primary_key(fresh_db):
table = fresh_db["table"]
table.upsert_all(