Skip to content

Commit

Permalink
Merge branch 'main' into improv/pipeline_integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkells authored Nov 3, 2024
2 parents d59f84b + aa6ee27 commit 5691146
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/test_decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from healthchain.apimethod import APIMethod
import pytest

from healthchain.clients import ehr
from healthchain.decorators import find_attributes_of_type, assign_to_attribute
from healthchain.decorators import api, find_attributes_of_type, assign_to_attribute

from .conftest import MockDataGenerator

Expand Down Expand Up @@ -64,3 +65,18 @@ def test_multiple_calls(self, function, mock_cds):


# TODO: add test for api decorator
def test_api_decorator():
@api
def test_function():
return "test"

# test if the function is correctly wrapped in the APImethod instance.
result = test_function()
assert isinstance(result, APIMethod)
assert result.func() == "test"

# test if function has "is_service_route"
assert hasattr(test_function, "is_service_route")

# test if the "is_service_route" member is set to True.
assert test_function.is_service_route is True

0 comments on commit 5691146

Please sign in to comment.