Skip to content

Commit

Permalink
Add test_bulk_update_pk_non_id
Browse files Browse the repository at this point in the history
  • Loading branch information
abvf committed Aug 4, 2024
1 parent 1bf6b04 commit 7a13fc8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ async def test_bulk_update_datetime(self):
self.assertEqual((await DatetimeFields.get(pk=objs[0].pk)).datetime, t0)
self.assertEqual((await DatetimeFields.get(pk=objs[1].pk)).datetime, t1)

async def test_bulk_update_pk_non_id(self):
tournament = await Tournament.create(name="")
events = [
await Event.create(name="1", tournament=tournament),
await Event.create(name="2", tournament=tournament),
]
events[0].name = "3"
events[1].name = "4"
rows_affected = await Event.bulk_update(events, fields=["name"])
self.assertEqual(rows_affected, 2)
self.assertEqual((await Event.get(pk=events[0].pk)).name, events[0].name)
self.assertEqual((await Event.get(pk=events[1].pk)).name, events[1].name)

async def test_bulk_update_pk_uuid(self):
objs = [
await UUIDFields.create(data=uuid.uuid4()),
Expand Down

0 comments on commit 7a13fc8

Please sign in to comment.