WIP changes up to join redefinition pending - use fields instead of join_params

This commit is contained in:
collerek
2021-01-10 17:27:52 +01:00
parent 4071ff7d11
commit 8b67c83d0c
16 changed files with 151 additions and 84 deletions

View File

@ -80,6 +80,17 @@ async def cleanup():
await Author.objects.delete(each=True)
@pytest.mark.asyncio
async def test_not_saved_raises_error(cleanup):
async with database:
guido = await Author(first_name="Guido", last_name="Van Rossum").save()
post = await Post.objects.create(title="Hello, M2M", author=guido)
news = Category(name="News")
with pytest.raises(ModelPersistenceError):
await post.categories.add(news)
@pytest.mark.asyncio
async def test_assigning_related_objects(cleanup):
async with database: