Skip to content

Commit faf54db

Browse files
committed
reorganize testing suite
1 parent 3f28d2d commit faf54db

33 files changed

+18
-18
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MockAuthClient(AuthenticationMixin):
1717
def __init__(self):
1818
super().__init__()
1919
self.username = "test_user"
20-
self.api_key = "test_api_key"
20+
self.api_key = "test_api_key" # pragma: allowlist secret
2121
self.account_name = None
2222
self.base_url = "https://api.test.com"
2323
self.headers = {}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ def base_client(self, mock_config):
3434
"""Create a ProjectXBase client for testing."""
3535
return ProjectXBase(
3636
username="testuser",
37-
api_key="test-api-key",
37+
api_key="test-api-key", # pragma: allowlist secret
3838
config=mock_config,
3939
account_name="TEST_ACCOUNT",
4040
)
4141

4242
def test_initialization(self, base_client):
4343
"""Test client initialization."""
4444
assert base_client.username == "testuser"
45-
assert base_client.api_key == "test-api-key"
45+
assert base_client.api_key == "test-api-key" # pragma: allowlist secret
4646
assert base_client.account_name == "TEST_ACCOUNT"
4747
assert base_client.base_url == "https://api.test.com"
4848
assert base_client._client is None
@@ -56,10 +56,10 @@ def test_initialization_with_defaults(self):
5656
"""Test client initialization with default config."""
5757
client = ProjectXBase(
5858
username="user",
59-
api_key="key",
59+
api_key="key", # pragma: allowlist secret
6060
)
6161
assert client.username == "user"
62-
assert client.api_key == "key"
62+
assert client.api_key == "key" # pragma: allowlist secret
6363
assert client.account_name is None
6464
assert client.base_url == "https://api.topstepx.com/api" # Default URL
6565

@@ -146,15 +146,15 @@ async def test_from_env_success(self):
146146
os.environ,
147147
{
148148
"PROJECT_X_USERNAME": "env_user",
149-
"PROJECT_X_API_KEY": "env_key",
149+
"PROJECT_X_API_KEY": "env_key", # pragma: allowlist secret
150150
"PROJECT_X_ACCOUNT_NAME": "env_account",
151151
},
152152
):
153153
with patch("project_x_py.client.base.ConfigManager") as mock_config_manager:
154154
mock_manager = Mock()
155155
mock_manager.get_auth_config.return_value = {
156156
"username": "env_user",
157-
"api_key": "env_key",
157+
"api_key": "env_key", # pragma: allowlist secret
158158
}
159159
mock_config_manager.return_value = mock_manager
160160

@@ -165,7 +165,7 @@ async def test_from_env_success(self):
165165
):
166166
async with ProjectXBase.from_env() as client:
167167
assert client.username == "env_user"
168-
assert client.api_key == "env_key"
168+
assert client.api_key == "env_key" # pragma: allowlist secret
169169
assert (
170170
client.account_name == "ENV_ACCOUNT"
171171
) # Should be uppercase
@@ -177,14 +177,14 @@ async def test_from_env_with_custom_account(self):
177177
os.environ,
178178
{
179179
"PROJECT_X_USERNAME": "env_user",
180-
"PROJECT_X_API_KEY": "env_key",
180+
"PROJECT_X_API_KEY": "env_key", # pragma: allowlist secret
181181
},
182182
):
183183
with patch("project_x_py.client.base.ConfigManager") as mock_config_manager:
184184
mock_manager = Mock()
185185
mock_manager.get_auth_config.return_value = {
186186
"username": "env_user",
187-
"api_key": "env_key",
187+
"api_key": "env_key", # pragma: allowlist secret
188188
}
189189
mock_config_manager.return_value = mock_manager
190190

@@ -218,14 +218,14 @@ async def test_from_env_with_custom_config(self):
218218
os.environ,
219219
{
220220
"PROJECT_X_USERNAME": "env_user",
221-
"PROJECT_X_API_KEY": "env_key",
221+
"PROJECT_X_API_KEY": "env_key", # pragma: allowlist secret
222222
},
223223
):
224224
with patch("project_x_py.client.base.ConfigManager") as mock_config_manager:
225225
mock_manager = Mock()
226226
mock_manager.get_auth_config.return_value = {
227227
"username": "env_user",
228-
"api_key": "env_key",
228+
"api_key": "env_key", # pragma: allowlist secret
229229
}
230230
mock_config_manager.return_value = mock_manager
231231

@@ -258,7 +258,7 @@ async def test_from_config_file(self):
258258
mock_manager.load_config.return_value = mock_config
259259
mock_manager.get_auth_config.return_value = {
260260
"username": "file_user",
261-
"api_key": "file_key",
261+
"api_key": "file_key", # pragma: allowlist secret
262262
}
263263
mock_config_manager.return_value = mock_manager
264264

@@ -269,7 +269,7 @@ async def test_from_config_file(self):
269269
):
270270
async with ProjectXBase.from_config_file("test_config.json") as client:
271271
assert client.username == "file_user"
272-
assert client.api_key == "file_key"
272+
assert client.api_key == "file_key" # pragma: allowlist secret
273273
assert client.base_url == "https://file.api.com"
274274

275275
# Verify ConfigManager was called with the config file
@@ -295,7 +295,7 @@ async def test_from_config_file_with_account_name(self):
295295
mock_manager.load_config.return_value = mock_config
296296
mock_manager.get_auth_config.return_value = {
297297
"username": "file_user",
298-
"api_key": "file_key",
298+
"api_key": "file_key", # pragma: allowlist secret
299299
}
300300
mock_config_manager.return_value = mock_manager
301301

@@ -317,7 +317,7 @@ def test_config_property(self, mock_config):
317317
"""Test config property."""
318318
client = ProjectXBase(
319319
username="user",
320-
api_key="key",
320+
api_key="key", # pragma: allowlist secret
321321
config=mock_config,
322322
)
323323
assert client.config == mock_config
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async def test_client_instantiation():
2020
client = ProjectX(username="test", api_key="test-key")
2121
assert client is not None
2222
assert client.username == "test"
23-
assert client.api_key == "test-key"
23+
assert client.api_key == "test-key" # pragma: allowlist secret
2424
assert client.account_name is None
2525

2626

tests/config/__init__.py

Whitespace-only changes.

tests/event_system/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)