Test removing one related object from M2M relation.
(db)
| 64 | |
| 65 | @pytest.mark.asyncio |
| 66 | async def test__remove(db): |
| 67 | """Test removing one related object from M2M relation.""" |
| 68 | one = await testmodels.M2MOne.create(name="One") |
| 69 | two1 = await testmodels.M2MTwo.create(name="Two") |
| 70 | two2 = await testmodels.M2MTwo.create(name="Two") |
| 71 | await one.two.add(two1, two2) |
| 72 | await one.two.remove(two1) |
| 73 | assert await one.two == [two2] |
| 74 | assert await two1.one == [] |
| 75 | assert await two2.one == [one] |
| 76 | |
| 77 | |
| 78 | @pytest.mark.asyncio |