File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 88import pytest
99import os
1010from urllib .parse import urlparse
11- from seclab_taskflow_agent .capi import get_AI_endpoint , AI_API_ENDPOINT_ENUM
11+ from seclab_taskflow_agent .capi import get_AI_endpoint , AI_API_ENDPOINT_ENUM , list_capi_models
1212
1313class TestAPIEndpoint :
1414 """Test API endpoint configuration."""
@@ -51,5 +51,19 @@ def test_to_url_githubcopilot(self):
5151 endpoint = AI_API_ENDPOINT_ENUM .AI_API_GITHUBCOPILOT
5252 assert endpoint .to_url () == 'https://api.githubcopilot.com'
5353
54+ def test_unsupported_endpoint (self ):
55+ original_env = os .environ .pop ('AI_API_ENDPOINT' , None )
56+ api_endpoint = 'https://unsupported.example.com'
57+ os .environ ['AI_API_ENDPOINT' ] = api_endpoint
58+
59+ with pytest .raises (ValueError ) as excinfo :
60+ list_capi_models ("abc" )
61+ msg = str (excinfo .value )
62+ assert 'Unsupported Model Endpoint' in msg
63+ assert 'https://models.github.ai/inference' in msg
64+ assert 'https://api.githubcopilot.com' in msg
65+ if original_env :
66+ os .environ ['AI_API_ENDPOINT' ] = original_env
67+
5468if __name__ == '__main__' :
5569 pytest .main ([__file__ , '-v' ])
You can’t perform that action at this time.
0 commit comments