|
1 | 1 | """Unit tests for functions defined in src/configuration.py.""" |
2 | 2 |
|
3 | 3 | import pytest |
4 | | -from configuration import AppConfig |
| 4 | +from configuration import AppConfig, LogicError |
5 | 5 | from models.config import ModelContextProtocolServer |
6 | 6 |
|
7 | 7 |
|
@@ -290,63 +290,49 @@ def test_mcp_servers_property_with_servers() -> None: |
290 | 290 | def test_configuration_not_loaded(): |
291 | 291 | """Test that accessing configuration before loading raises an error.""" |
292 | 292 | cfg = AppConfig() |
293 | | - with pytest.raises( |
294 | | - AssertionError, match="logic error: configuration is not loaded" |
295 | | - ): |
| 293 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
296 | 294 | cfg.configuration # pylint: disable=pointless-statement |
297 | 295 |
|
298 | 296 |
|
299 | 297 | def test_service_configuration_not_loaded(): |
300 | 298 | """Test that accessing service_configuration before loading raises an error.""" |
301 | 299 | cfg = AppConfig() |
302 | | - with pytest.raises( |
303 | | - AssertionError, match="logic error: configuration is not loaded" |
304 | | - ): |
| 300 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
305 | 301 | cfg.service_configuration # pylint: disable=pointless-statement |
306 | 302 |
|
307 | 303 |
|
308 | 304 | def test_llama_stack_configuration_not_loaded(): |
309 | 305 | """Test that accessing llama_stack_configuration before loading raises an error.""" |
310 | 306 | cfg = AppConfig() |
311 | | - with pytest.raises( |
312 | | - AssertionError, match="logic error: configuration is not loaded" |
313 | | - ): |
| 307 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
314 | 308 | cfg.llama_stack_configuration # pylint: disable=pointless-statement |
315 | 309 |
|
316 | 310 |
|
317 | 311 | def test_user_data_collection_configuration_not_loaded(): |
318 | 312 | """Test that accessing user_data_collection_configuration before loading raises an error.""" |
319 | 313 | cfg = AppConfig() |
320 | | - with pytest.raises( |
321 | | - AssertionError, match="logic error: configuration is not loaded" |
322 | | - ): |
| 314 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
323 | 315 | cfg.user_data_collection_configuration # pylint: disable=pointless-statement |
324 | 316 |
|
325 | 317 |
|
326 | 318 | def test_mcp_servers_not_loaded(): |
327 | 319 | """Test that accessing mcp_servers before loading raises an error.""" |
328 | 320 | cfg = AppConfig() |
329 | | - with pytest.raises( |
330 | | - AssertionError, match="logic error: configuration is not loaded" |
331 | | - ): |
| 321 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
332 | 322 | cfg.mcp_servers # pylint: disable=pointless-statement |
333 | 323 |
|
334 | 324 |
|
335 | 325 | def test_authentication_configuration_not_loaded(): |
336 | 326 | """Test that accessing authentication_configuration before loading raises an error.""" |
337 | 327 | cfg = AppConfig() |
338 | | - with pytest.raises( |
339 | | - AssertionError, match="logic error: configuration is not loaded" |
340 | | - ): |
| 328 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
341 | 329 | cfg.authentication_configuration # pylint: disable=pointless-statement |
342 | 330 |
|
343 | 331 |
|
344 | 332 | def test_customization_not_loaded(): |
345 | 333 | """Test that accessing customization before loading raises an error.""" |
346 | 334 | cfg = AppConfig() |
347 | | - with pytest.raises( |
348 | | - AssertionError, match="logic error: configuration is not loaded" |
349 | | - ): |
| 335 | + with pytest.raises(LogicError, match="logic error: configuration is not loaded"): |
350 | 336 | cfg.customization # pylint: disable=pointless-statement |
351 | 337 |
|
352 | 338 |
|
|
0 commit comments