Skip to content

Commit

Permalink
model rebuild for openapi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moonbox3 committed Dec 19, 2024
1 parent e1e9e74 commit b6f216e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ async def dummy_auth_callback(**kwargs):

@pytest.fixture
def openapi_runner_with_predicate_callback():
from semantic_kernel.connectors.openapi_plugin import OperationSelectionPredicateContext # noqa: F401

OpenAPIFunctionExecutionParameters.model_rebuild()

# Define a dummy predicate callback
def predicate_callback(context):
# Skip operations with DELETE method or containing 'internal' in the path
Expand Down Expand Up @@ -809,6 +813,10 @@ async def test_run_operation_with_error(mock_request, openapi_runner):


def test_invalid_server_url_override():
from semantic_kernel.connectors.openapi_plugin import OperationSelectionPredicateContext # noqa: F401

OpenAPIFunctionExecutionParameters.model_rebuild()

with pytest.raises(ValueError, match="Invalid server_url_override: invalid_url"):
params = OpenAPIFunctionExecutionParameters(server_url_override="invalid_url")
params.model_post_init(None)

0 comments on commit b6f216e

Please sign in to comment.