mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix fsmcontextproxy update (#755)
* Create test case for invalid 'FSMContextProxy.update()' function * Fix invalid 'FSMContextProxy.update()' function * Verify that written data has been stored and read back correctly
This commit is contained in:
parent
bccfca7cae
commit
d646e19852
2 changed files with 16 additions and 0 deletions
14
tests/test_dispatcher/test_fsm_context.py
Normal file
14
tests/test_dispatcher/test_fsm_context.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import pytest
|
||||
from aiogram.contrib.fsm_storage.memory import MemoryStorage
|
||||
from aiogram.dispatcher import FSMContext
|
||||
|
||||
|
||||
class TestFSMContext:
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_data(self):
|
||||
context = FSMContext(MemoryStorage(), chat=1, user=1)
|
||||
async with context.proxy() as data:
|
||||
data.update(key1="value1", key2="value2")
|
||||
async with context.proxy() as data:
|
||||
assert data['key1'] == "value1"
|
||||
assert data['key2'] == "value2"
|
||||
Loading…
Add table
Add a link
Reference in a new issue