Skip to content

Commit 92be5d1

Browse files
authored
Refactor testing functions to use create_ as their prefix (rather than testing) for consistency (#164)
1 parent 629dd48 commit 92be5d1

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

tests/hosting_core/_oauth/test_oauth_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
FLOW_DATA = TEST_FLOW_DATA()
2626

2727

28-
def testing_Activity(
28+
def create_testing_Activity(
2929
mocker,
3030
type=ActivityTypes.message,
3131
name="a",
@@ -53,7 +53,7 @@ def testing_Activity(
5353
class TestUtils(FlowStateFixtures):
5454
def setup_method(self):
5555
self.UserTokenClient = mock_UserTokenClient
56-
self.Activity = testing_Activity
56+
self.Activity = create_testing_Activity
5757

5858
@pytest.fixture
5959
def user_token_client(self, mocker):

tests/hosting_core/app/_oauth/_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
DEFAULTS = TEST_DEFAULTS()
99

1010

11-
def testing_Activity():
11+
def create_testing_Activity():
1212
return Activity(
1313
type=ActivityTypes.message,
1414
channel_id=DEFAULTS.channel_id,
@@ -17,7 +17,7 @@ def testing_Activity():
1717
)
1818

1919

20-
def testing_TurnContext(
20+
def create_testing_TurnContext(
2121
mocker,
2222
channel_id=DEFAULTS.channel_id,
2323
user_id=DEFAULTS.user_id,
@@ -45,7 +45,7 @@ def testing_TurnContext(
4545
return turn_context
4646

4747

48-
def testing_TurnContext_magic(
48+
def create_testing_TurnContext_magic(
4949
mocker,
5050
channel_id=DEFAULTS.channel_id,
5151
user_id=DEFAULTS.user_id,

tests/hosting_core/app/_oauth/_handlers/test_agentic_user_authorization.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from tests._common.mock_utils import mock_class
1919

2020
from .._common import (
21-
testing_TurnContext_magic,
21+
create_testing_TurnContext_magic,
2222
)
2323

2424
DEFAULTS = TEST_DEFAULTS()
@@ -27,7 +27,7 @@
2727

2828
class TestUtils:
2929
def setup_method(self, mocker):
30-
self.TurnContext = testing_TurnContext_magic
30+
self.TurnContext = create_testing_TurnContext_magic
3131

3232
@pytest.fixture
3333
def storage(self):
@@ -78,7 +78,6 @@ def mock_class_provider(
7878

7979

8080
class TestAgenticUserAuthorization(TestUtils):
81-
8281
@pytest.mark.asyncio
8382
async def test_get_agentic_instance_token_not_agentic(
8483
self, mocker, non_agentic_role, agentic_auth

tests/hosting_core/app/_oauth/_handlers/test_user_authorization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def _handle_flow_response(self, *args, **kwargs):
4949
pass
5050

5151

52-
def testing_TurnContext(
52+
def create_testing_TurnContext(
5353
mocker,
5454
channel_id=DEFAULTS.channel_id,
5555
user_id=DEFAULTS.user_id,
@@ -94,7 +94,7 @@ def mock_provider(mocker, exchange_token=None):
9494

9595
class TestEnv(FlowStateFixtures):
9696
def setup_method(self):
97-
self.TurnContext = testing_TurnContext
97+
self.TurnContext = create_testing_TurnContext
9898

9999
@pytest.fixture
100100
def context(self, mocker):

tests/hosting_core/app/_oauth/test_authorization.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
mock_class_Authorization,
4545
)
4646

47-
from ._common import testing_TurnContext, testing_Activity
47+
from ._common import create_testing_TurnContext, create_testing_Activity
4848

4949
DEFAULTS = TEST_DEFAULTS()
5050
FLOW_DATA = TEST_FLOW_DATA()
@@ -109,7 +109,7 @@ def copy_sign_in_state(state: _SignInState) -> _SignInState:
109109

110110
class TestEnv(FlowStateFixtures):
111111
def setup_method(self):
112-
self.TurnContext = testing_TurnContext
112+
self.TurnContext = create_testing_TurnContext
113113
self.UserTokenClient = mock_UserTokenClient
114114
self.ConnectionManager = lambda mocker: MockConnectionManager()
115115

@@ -119,7 +119,7 @@ def context(self, mocker):
119119

120120
@pytest.fixture
121121
def activity(self):
122-
return testing_Activity()
122+
return create_testing_Activity()
123123

124124
@pytest.fixture
125125
def baseline_storage(self):
@@ -191,7 +191,6 @@ def test_sign_in_state_key(self, mocker, connection_manager, storage):
191191

192192

193193
class TestAuthorizationUsage(TestEnv):
194-
195194
@pytest.mark.asyncio
196195
@pytest.mark.parametrize(
197196
"initial_turn_state, final_turn_state, initial_sign_in_state, auth_handler_id",

0 commit comments

Comments
 (0)