8000 Correction for pytest · guptarohan41/botbuilder-python@6293241 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6293241

Browse files
committed
Correction for pytest
1 parent 6990185 commit 6293241

File tree

5 files changed

+40
-40
lines changed

5 files changed

+40
-40
lines changed

libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ def __init__(self, settings: BotFrameworkAdapterSettings):
157157
super(BotFrameworkAdapter, self).__init__()
158158
self.settings = settings or BotFrameworkAdapterSettings("", "")
159159

160-
# If settings.certificateThumbprint & settings.certificatePrivateKey are provided,
160+
# If settings.certificate_thumbprint & settings.certificate_private_key are provided,
161161
# use CertificateAppCredentials.
162-
if settings.certificate_thumbprint and settings.certificate_private_key:
162+
if self.settings.certificate_thumbprint and settings.certificate_private_key:
163163
self._credentials = CertificateAppCredentials(
164164
self.settings.app_id,
165165
self.settings.certificate_thumbprint,
@@ -181,7 +181,7 @@ def __init__(self, settings: BotFrameworkAdapterSettings):
181181

182182
self._is_emulating_oauth_cards = False
183183

184-
# If no channelService or openIdMetadata values were passed in the settings, check the
184+
# If no channel_service or open_id_metadata values were passed in the settings, check the
185185
# process' Environment Variables for values.
186186
# These values may be set when a bot is provisioned on Azure and if so are required for
187187
# the bot to properly work in Public Azure or a National Cloud.

libraries/botframework-connector/botframework/connector/auth/app_credentials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class AppCredentials(Authentication):
1414
"""
15-
Base class for token retrieval. Subclasses MUST override get_token in
15+
Base class for token retrieval. Subclasses MUST override get_access_token in
1616
order to supply a valid token for the specific credentials.
1717
"""
1818

@@ -103,7 +103,7 @@ def signed_session(self, session: requests.Session = None) -> requests.Session:
103103

104104
return session
105105

106-
def get_access_token(self) -> str:
106+
def get_access_token(self, force_refresh: bool = False) -> str:
107107
"""
108108
Returns a token for the current AppCredentials.
109109
:return: The token

libraries/botframework-connector/botframework/connector/auth/certificate_app_credentials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141
},
4242
)
4343

44-
def get_access_token(self) -> str:
44+
def get_access_token(self, force_refresh: bool = False) -> str:
4545
"""
4646
Implementation of AppCredentials.get_token.
4747
:return: The access token for the given certificate.

libraries/botframework-connector/botframework/connector/auth/microsoft_app_credentials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(
3636
)
3737
self.scopes = [self.oauth_scope]
3838

39-
def get_access_token(self) -> str:
39+
def get_access_token(self, force_refresh: bool = False) -> str:
4040
"""
4141
Implementation of AppCredentials.get_token.
4242
:return: The access token for the given app id and password.
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import aiounittest
2-
3-
from botframework.connector.auth import AuthenticationConstants, MicrosoftAppCredentials
4-
5-
6-
class TestMicrosoftAppCredentials(aiounittest.AsyncTestCase):
7-
async def test_app_credentials(self):
8-
default_scope_case_1 = MicrosoftAppCredentials("some_app", "some_password")
9-
assert (
10-
AuthenticationConstants.TO_BOT_FROM_CHANNEL_TOKEN_ISSUER
11-
== default_scope_case_1.oauth_scope
12-
)
13-
14-
# Use with default scope
15-
default_scope_case_2 = MicrosoftAppCredentials(
16-
"some_app", "some_password", "some_tenant"
17-
)
18-
assert (
19-
AuthenticationConstants.TO_BOT_FROM_CHANNEL_TOKEN_ISSUER
20-
== default_scope_case_2.oauth_scope
21-
)
22-
23-
custom_scope = "some_scope"
24-
custom_scope_case_1 = MicrosoftAppCredentials(
25-
"some_app", "some_password", oauth_scope=custom_scope
26-
)
27-
assert custom_scope_case_1.oauth_scope == custom_scope
28-
29-
# Use with default scope
30-
custom_scope_case_2 = MicrosoftAppCredentials(
31-
"some_app", "some_password", "some_tenant", custom_scope
32-
)
33-
assert custom_scope_case_2.oauth_scope == custom_scope
1+
import aiounittest
2+
3+
from botframework.connector.auth import AuthenticationConstants, MicrosoftAppCredentials
4+
5+
6+
class TestMicrosoftAppCredentials(aiounittest.AsyncTestCase):
7+
async def test_app_credentials(self):
8+
default_scope_case_1 = MicrosoftAppCredentials("some_app", "some_password")
9+
assert (
10+
AuthenticationConstants.TO_BOT_FROM_CHANNEL_TOKEN_ISSUER
11+
== default_scope_case_1.oauth_scope
12+
)
13+
14+
# Use with default scope
15+
default_scope_case_2 = MicrosoftAppCredentials(
16+
"some_app", "some_password", "some_tenant"
17+
)
18+
assert (
19+
AuthenticationConstants.TO_CHANNEL_FROM_BOT_OAUTH_SCOPE
20+
== default_scope_case_2.oauth_scope
21+
)
22+
23+
custom_scope = "some_scope"
24+
custom_scope_case_1 = MicrosoftAppCredentials(
25+
"some_app", "some_password", oauth_scope=custom_scope
26+
)
27+
assert custom_scope_case_1.oauth_scope == custom_scope
28+
29+
# Use with default scope
30+
custom_scope_case_2 = MicrosoftAppCredentials(
31+
"some_app", "some_password", "some_tenant", custom_scope
32+
)
33+
assert custom_scope_case_2.oauth_scope == custom_scope

0 commit comments

Comments
 (0)
0