Test removing multiple related objects at once.
(db)
| 77 | |
| 78 | @pytest.mark.asyncio |
| 79 | async def test__remove__many(db): |
| 80 | """Test removing multiple related objects at once.""" |
| 81 | one = await testmodels.M2MOne.create(name="One") |
| 82 | two1 = await testmodels.M2MTwo.create(name="Two1") |
| 83 | two2 = await testmodels.M2MTwo.create(name="Two2") |
| 84 | two3 = await testmodels.M2MTwo.create(name="Two3") |
| 85 | await one.two.add(two1, two2, two3) |
| 86 | await one.two.remove(two1, two2) |
| 87 | assert await one.two == [two3] |
| 88 | assert await two1.one == [] |
| 89 | assert await two2.one == [] |
| 90 | assert await two3.one == [one] |
| 91 | |
| 92 | |
| 93 | @pytest.mark.asyncio |