Skip to content

Commit

Permalink
Add test_requires_dependency.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil authored Dec 16, 2024
1 parent dc16c8f commit 64c7d4d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/dependencies/test_requires_dependency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pytest

from esmerald.param_functions import Requires
from esmerald.utils.dependencies import RequiresDependency, get_requires_dependency


def function_one():
return "function_one"


def function_two(name=Requires(function_one)):
return name


def function_three(name=Requires(function_two)):
return name


@pytest.mark.asyncio
async def test_required_dependency():

injector = RequiresDependency()
requires = await get_requires_dependency(injector, function_three)

assert requires.dependency() == "function_one"

0 comments on commit 64c7d4d

Please sign in to comment.