Adds delete function at a class level.

This commit is contained in:
Simon Prickett 2022-02-14 20:44:49 +00:00
parent 2be01743a3
commit 885b24b35b
3 changed files with 38 additions and 0 deletions

View file

@ -374,6 +374,21 @@ async def test_saves_model_and_creates_pk(m):
member2 = await m.Member.get(member.pk)
assert member2 == member
@pytest.mark.asyncio
async def test_delete(m):
member = m.Member(
first_name="Simon",
last_name="Prickett",
email="s@example.com",
join_date=today,
age=97,
bio="This is a test use to be deleted.",
)
await member.save()
response = await m.Member.delete(member.pk)
assert response == 1
def test_raises_error_with_embedded_models(m):
class Address(m.BaseHashModel):

View file

@ -186,6 +186,21 @@ async def test_saves_model_and_creates_pk(address, m, redis):
assert member2 == member
assert member2.address == address
@pytest.mark.asyncio
async def test_delete(address, m, redis):
member = m.Member(
first_name="Simon",
last_name="Prickett",
email="s@example.com",
join_date=today,
age=38,
address=address,
)
await member.save()
response = await m.Member.delete(member.pk)
assert response == 1
@pytest.mark.asyncio
async def test_saves_many_implicit_pipeline(address, m):