-
Notifications
You must be signed in to change notification settings - Fork 86
Supporting RestChannelServiceClientFactory configuration from ChannelAdapter constructor #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Rodrigo Brandão (rodrigobr-msft)
merged 4 commits into
main
from
users/robrandao/regionalized-client
Jul 31, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
477b2c1
Supporting RestChannelServiceClientFactory configuration from Channel…
rodrigobr-msft d3ac3b6
Updating changelog.md
rodrigobr-msft 3a3b2bd
Merge branch 'main' into users/robrandao/regionalized-client
rodrigobr-msft a87e8ac
Merge branch 'main' into users/robrandao/regionalized-client
rodrigobr-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
52 changes: 52 additions & 0 deletions
52
dev/integration/tests/adapter/test_aiohttp_cloud_adapter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from typing import cast | ||
|
|
||
| import pytest | ||
|
|
||
| from microsoft_agents.activity import Activity, ConversationAccount | ||
| from microsoft_agents.hosting.aiohttp import CloudAdapter | ||
| from microsoft_agents.hosting.core import TurnContext | ||
| from microsoft_agents.hosting.core.authorization import ClaimsIdentity, Connections | ||
| from microsoft_agents.hosting.core.connector.client import UserTokenClient | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| @pytest.mark.parametrize( | ||
| "token_service_endpoint", | ||
| [ | ||
| "https://europe.api.botframework.com", | ||
| "https://unitedstates.api.botframework.com", | ||
| "https://india.api.botframework.com", | ||
| ], | ||
| ) | ||
| async def test_cloud_adapter_configures_user_token_client_endpoint( | ||
| token_service_endpoint: str, | ||
| ): | ||
| adapter = CloudAdapter( | ||
| connection_manager=cast(Connections, object()), | ||
| channel_service_client_factory_options={ | ||
| "token_service_endpoint": token_service_endpoint | ||
| }, | ||
| ) | ||
| identity = ClaimsIdentity({"aud": "test-app-id"}, True) | ||
| context = TurnContext( | ||
| adapter, | ||
| Activity( | ||
| type="message", | ||
| conversation=ConversationAccount(id="conversation-id"), | ||
| ), | ||
| identity, | ||
| ) | ||
|
|
||
| client = await adapter._channel_service_client_factory.create_user_token_client( | ||
| context, | ||
| identity, | ||
| use_anonymous=True, | ||
| ) | ||
| assert isinstance(client, UserTokenClient) | ||
| try: | ||
| assert str(client.client._base_url) == f"{token_service_endpoint}/" | ||
| finally: | ||
| await client.close() | ||
52 changes: 52 additions & 0 deletions
52
dev/integration/tests/adapter/test_fastapi_cloud_adapter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from typing import cast | ||
|
|
||
| import pytest | ||
|
|
||
| from microsoft_agents.activity import Activity, ConversationAccount | ||
| from microsoft_agents.hosting.core import TurnContext | ||
| from microsoft_agents.hosting.core.authorization import ClaimsIdentity, Connections | ||
| from microsoft_agents.hosting.core.connector.client import UserTokenClient | ||
| from microsoft_agents.hosting.fastapi import CloudAdapter | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| @pytest.mark.parametrize( | ||
| "token_service_endpoint", | ||
| [ | ||
| "https://europe.api.botframework.com", | ||
| "https://unitedstates.api.botframework.com", | ||
| "https://india.api.botframework.com", | ||
| ], | ||
| ) | ||
| async def test_cloud_adapter_configures_user_token_client_endpoint( | ||
| token_service_endpoint: str, | ||
| ): | ||
| adapter = CloudAdapter( | ||
| connection_manager=cast(Connections, object()), | ||
| channel_service_client_factory_options={ | ||
| "token_service_endpoint": token_service_endpoint | ||
| }, | ||
| ) | ||
| identity = ClaimsIdentity({"aud": "test-app-id"}, True) | ||
| context = TurnContext( | ||
| adapter, | ||
| Activity( | ||
| type="message", | ||
| conversation=ConversationAccount(id="conversation-id"), | ||
| ), | ||
| identity, | ||
| ) | ||
|
|
||
| client = await adapter._channel_service_client_factory.create_user_token_client( | ||
| context, | ||
| identity, | ||
| use_anonymous=True, | ||
| ) | ||
| assert isinstance(client, UserTokenClient) | ||
| try: | ||
| assert str(client.client._base_url) == f"{token_service_endpoint}/" | ||
| finally: | ||
| await client.close() | ||
|
rodrigobr-msft marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.