Test adding multiple related objects at once.
(db)
| 52 | |
| 53 | @pytest.mark.asyncio |
| 54 | async def test__add__two(db): |
| 55 | """Test adding multiple related objects at once.""" |
| 56 | one = await testmodels.M2MOne.create(name="One") |
| 57 | two1 = await testmodels.M2MTwo.create(name="Two") |
| 58 | two2 = await testmodels.M2MTwo.create(name="Two") |
| 59 | await one.two.add(two1, two2) |
| 60 | assert await one.two == [two1, two2] |
| 61 | assert await two1.one == [one] |
| 62 | assert await two2.one == [one] |
| 63 | |
| 64 | |
| 65 | @pytest.mark.asyncio |