Skip to content

Commit

Permalink
fix: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
moshego189 committed Jan 22, 2024
1 parent 66aa083 commit 20a2347
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/ut/backends/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ async def test_raw(self, memory):

async def test_redlock_release(self, memory):
memory._cache.get.return_value = "lock"
fake = create_autospec(asyncio.TimerHandle, instance=True)
memory._handlers[Keys.KEY] = fake
assert await memory._redlock_release(Keys.KEY, "lock") == 1
memory._cache.get.assert_called_with(Keys.KEY)
memory._cache.pop.assert_called_with(Keys.KEY)
memory._cache.pop.assert_called_with(Keys.KEY, None)
assert fake.cancel.call_count == 1
assert Keys.KEY not in memory._handlers

async def test_redlock_release_nokey(self, memory):
memory._cache.get.return_value = None
Expand Down

0 comments on commit 20a2347

Please sign in to comment.