-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from redis/add-expire-#171
Add expire behavior
- Loading branch information
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -391,6 +391,24 @@ async def test_delete(m): | |
assert response == 1 | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_expire(m): | ||
member = m.Member( | ||
first_name="Expire", | ||
last_name="Test", | ||
email="[email protected]", | ||
join_date=today, | ||
age=93, | ||
bio="This is a test user for expiry", | ||
) | ||
|
||
await member.save() | ||
await member.expire(60) | ||
|
||
ttl = await m.Member.db().ttl(member.key()) | ||
assert ttl > 0 | ||
|
||
|
||
def test_raises_error_with_embedded_models(m): | ||
class Address(m.BaseHashModel): | ||
address_line_1: str | ||
|