mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add function get_value to BaseStorage (#1594)
* Add function `get_value` to all built-in storage implementations, `FSMContext` and `SceneWizard` (#1431) * Fix type hints * Split up return statements in `get_value` functions * Implement `get_value` method in `BaseStorage` and remove redundant implementations
This commit is contained in:
parent
fd014d2026
commit
592267dd99
8 changed files with 120 additions and 4 deletions
|
|
@ -1004,6 +1004,24 @@ class TestSceneWizard:
|
|||
|
||||
wizard.state.get_data.assert_called_once_with()
|
||||
|
||||
async def test_scene_wizard_get_value_with_default(self):
|
||||
wizard = SceneWizard(
|
||||
scene_config=AsyncMock(),
|
||||
manager=AsyncMock(),
|
||||
state=AsyncMock(),
|
||||
update_type="message",
|
||||
event=AsyncMock(),
|
||||
data={},
|
||||
)
|
||||
args = ("test_key", "test_default")
|
||||
value = "test_value"
|
||||
wizard.state.get_value = AsyncMock(return_value=value)
|
||||
|
||||
result = await wizard.get_value(*args)
|
||||
wizard.state.get_value.assert_called_once_with(*args)
|
||||
|
||||
assert result == value
|
||||
|
||||
async def test_scene_wizard_update_data_if_data(self):
|
||||
wizard = SceneWizard(
|
||||
scene_config=AsyncMock(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue