|
| 1 | +# from openapi_to_sdk.sdk_automation import PythonSDKBuilder |
| 2 | +# def test_smoke(): |
| 3 | +# sdk = PythonSDKBuilder( |
| 4 | +# inherited_properties=['username', 'api_key'], |
| 5 | +# decorators=['retry()'], |
| 6 | +# url='https://api.vctr.ai/' |
| 7 | +# ) |
| 8 | +# sdk.to_python_file(class_name='ViAPIClient', import_strings=['from vectorai.api.utils import retry'], |
| 9 | +# include_response_parsing=False) |
| 10 | +# assert True |
| 11 | + |
| 12 | + |
1 | 13 | from openapi_to_sdk.sdk_automation import PythonSDKBuilder
|
2 | 14 | def test_smoke():
|
3 | 15 | sdk = PythonSDKBuilder(
|
| 16 | + url="https://api.vctr.ai", |
4 | 17 | inherited_properties=['username', 'api_key'],
|
5 |
| - decorators=['retry()'], |
6 |
| - url='https://api.vctr.ai/' |
| 18 | + decorators=[ |
| 19 | + # 'retry()', |
| 20 | + "return_curl_or_response('json')"], |
7 | 21 | )
|
8 |
| - sdk.to_python_file(class_name='ViAPIClient', import_strings=['from vectorai.api.utils import retry'], |
9 |
| - include_response_parsing=False) |
10 |
| - assert True |
| 22 | + sdk.to_python_file( |
| 23 | + class_name="ViAPIClient", |
| 24 | + filename='api.py', |
| 25 | + import_strings=['import requests', 'from vectorai.api.utils import retry, return_curl_or_response'], |
| 26 | + internal_functions=[ |
| 27 | + "list_collections", |
| 28 | + "create_collection", |
| 29 | + "search" |
| 30 | + ] |
| 31 | + ) |
| 32 | + |
| 33 | +def test_import(): |
| 34 | + import api |
| 35 | + import os |
| 36 | + from api import ViAPIClient |
| 37 | + vi = ViAPIClient(os.environ['VI_USERNAME'], os.environ['VI_API_KEY']) |
| 38 | + assert len(vi._list_collections()) > 0 |
0 commit comments